Android Question how to call sub from java to b4a sub

Discussion in 'Android Questions' started by xiaoyao, Mar 6, 2015.

  1. xiaoyao

    xiaoyao Member Licensed 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?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

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