Android Question Using a Jar Kibrary

Discussion in 'Android Questions' started by Antonio Contesti Coll, May 30, 2015.

  1. Antonio Contesti Coll

    Antonio Contesti Coll Member Licensed User

    I've a Jar file called IvrJackU1.jar with some methods
    I attach the documentation.

    I also have a demo for android and the part of the code that call the method open

    reader = new IvrJackService();
    // reader = new IvrJackService();
    reader.open(this, this);

    I can call the method close with no error but i cant call the method open because uses 2 arguments and i dont know how to send in V4A

    my code

    #AdditionalJar: IvrJackU1

    Sub Activity_Create(FirstTime As Boolean)
    Dim b As Boolean
    Dim aa As Int
    b=True
    Dim wdj As JavaObject
    Dim adp As JavaObject
    wdj.InitializeNewInstance("rfid.ivrjacku1.IvrJackService",Null)
    adp.InitializeStatic("rfid.ivrjacku1.IvrJackAdapter")
    wdj.RunMethod("rfid.ivrjacku1.IvrJackAdapter",Array(GetContext,adp))
    aa=wdj.RunMethod ("readEPC",Array(b))
    Log(aa)

    End Sub
     
  2. Antonio Contesti Coll

    Antonio Contesti Coll Member Licensed User

    sorry there is one mistake on line
    wdj.RunMethod("rfid.ivrjacku1.IvrJackAdapter",Array(GetContext,adp))
    is
    wdj.RunMethod("open",Array(GetContext,adp)) and doesn't work
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    Based on the java code you should pass: Array(GetContext, GetContext)
     
  4. Antonio Contesti Coll

    Antonio Contesti Coll Member Licensed User

    I also tried and i 've the same error
    The library tells that open has 2 arguments
    arg 0= Context Activity Example
    arg 1= adapter used for event interface
    Here you have the example of the app in java

    Code:
    public class Demo extends Activity  implements IvrJackAdapter {
     
        
    private boolean bFirstLoad = true;
        
    private ImageView imgPlugout = null;
        
    private TextView txtStatus = null;
        
    private TextView txtTotal = null;
        
    private TextView txtDate = null;
        //
        
    private TextView lblEPC = null;
        
    private TextView lblTimes = null;
        
    private Button btnQuery = null;
        //
        
    private Button btnSetting = null;
        
    private Button clearScreen;
        
    private ListView epclist;
        //
        
    private ProgressDialogEx pd;
        
    private boolean bSuccess;
        
    private String cMsg;
     
        
    private boolean bCancel = false;
        
    private boolean bOpened = false;
        
    private MHandler handler = null;
        //
        
    private CustomListAdapter seqAdapter;
        
    private ArrayList<seqTag> seqArray = new ArrayList<seqTag>();
        
    private ArrayList<String> tagArray = new ArrayList<String>();
        
    private boolean bUpdateRequired = false;
     
        
    public static IvrJackService reader = null;
     
        @Override
        
    public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            //
            imgPlugout = (
    ImageView)findViewById(R.id.imgPlugout);
            btnQuery = (
    Button)findViewById(R.id.btnQuery);
            btnSetting = (
    Button)findViewById(R.id.btnSetting);
            btnSetting.setVisibility(
    View.GONE);
            btnSetting.setOnClickListener(new 
    View.OnClickListener()
           {
                
    public void onClick(View paramView)
                {
                    
    if (bOpened) {
                        showToast(
    "Please stop the inventory tag action.");
                        
    return;
                    
    }
                    Intent intent1 = new Intent();
                  intent1.setClass(Demo.this, activity_Setting.class);
                  startActivity(intent1);
                }
           });
            lblEPC = (TextView)findViewById(R.id.textView1);
            lblTimes = (TextView)findViewById(R.id.textView11);
            txtTotal = (TextView)findViewById(R.id.txtTotal);
            //
            txtStatus = (TextView)findViewById(R.id.txtStatus);
            txtDate = (TextView)findViewById(R.id.txtDate);
            clearScreen = (Button) findViewById(R.id.btnClear);
            clearScreen.setOnClickListener(new View.OnClickListener()
           {
             public void onClick(View paramView)
             {
               ListClear();
             }
           });
         
            //
            epclist = ((ListView)findViewById(R.id.tag_list));
            epclist.setCacheColorHint(Color.TRANSPARENT);
            epclist.setOnItemClickListener(new epclistItemClick());
           seqAdapter = new CustomListAdapter(this, R.layout.customlistview, this.seqArray);
           epclist.setAdapter(this.seqAdapter);
            //
            btnQuery.setOnClickListener(new btnQuery_Click());
            btnQuery.setVisibility(View.GONE);
            handler = new MHandler(this);
            //
            reader = new IvrJackService();
            reader.open(this, this);

    Thanks for the Help
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You can use JavaObject.CreateEvent to create the object that implements this interface and handle its callback.
     
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