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

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
 

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:
B4X:
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?
 
Top