Java Question i write java code,how to get class myresult value?

Discussion in 'Libraries developers questions' started by xiaoyao, Mar 22, 2015.

  1. xiaoyao

    xiaoyao Member Licensed User

    public class Javatoclass extends Activity {
    public static String myresult="load class ok";
    public static int int1=333;

    public static String AGetmyresult(){
    return myresult;
    }

    matrix.InitializeNewInstance("abc.Javatoclass", Null)

    Dim obj As Object
    Dim s As String
    obj=matrix.RunMethod("AGetmyresult",Null)
    s=obj
    Msgbox (s,"")

    obj=matrix.RunMethod("AGetmyresult",Null),its good

    how to get public myresult
     
  2. xiaoyao

    xiaoyao Member Licensed User

    Dim NewClass As JavaObject
    NewClass=matrix.InitializeNewInstance("abc.Javatoclass", Null)
    Dim r As Reflector
    r.Target =NewClass
    r.RunPublicmethod("main",args(),typs())

    args how to write code
    types how to write
    JAVA CODE IS:
    Code:
    Class[] argTypes = new Class[] { String[].class };
    String[] mainArgs = {File1};
    Method method=class1.getDeclaredMethod("main",argTypes);
    method.invoke(class1.newInstance(),(Object)mainArgs);
    HOW TO CHANGE B4A CODE?
     
  3. Johan Schoeman

    Johan Schoeman Expert Licensed User

    Take a look at @Erel tutorial and example about inline Java code.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice