Android Question how to call sub from java to b4a sub

xiaoyao

Member
Licensed User
Longtime User
i creat jar lib by java,how to call a sub from java code to b4a sub?
like this
i creat a java file "FirstLib.java"

package com.example;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
//import anywheresoftware.b4a.BA.*;
@Version(1.06f)
@ShortName("FirstLib")
//@Permissions(values={"android.permission.INTERNET"})
//@DependsOn(values={"some java library "})
//@ActivityObject
public class FirstLib {
public int add(int x, int y) {
return x + y;
}
public int add2(int x, int y) {
return x + y;
}
}


if i change this
public int add2(int x, int y) {
int c=0;
c=b4a.main.sub1(x,y);
return c;
}


in b4a ,have a sub
sub sub1(x as int ,y as int)
return x+y
end sub

c=b4a.main.sub1(x,y);i think it's wrong,how can i write the code?
 
Top