android - xamarin binding jar type error -


i have library .jar following function:

public void doaction(arraylist<string[][]> list, int[] time) { } 

i have create binding project , api.xml has code:

<method abstract="false" deprecated="not deprecated" final="false" name="doaction" native="false" return="void" static="false" synchronized="false" visibility="public"> <parameter name="p0" type="java.util.arraylist<java.lang.string[][]>"> </parameter> <parameter name="p1" type="int[]"> </parameter> </method> 

i have added reference of binding dll in android project , exploring dll see:

using android.runtime; using system; using system.collections.generic;  [register ("doaction", "(ljava/util/arraylist;[i)v", "getdoaction_ljava_util_arraylist_arrayihandler")] public virtual void doaction (ilist<string[][]> p0, int[] p1); 

the usage:

var mylist = new list<string [] []> (); var mycmd = new string [5] []; int [] exetime = new int [100];  mycmd = new string [5] []; mycmd [0] = new string [] { "f", "2" }; mycmd [1] = new string [] { "a", "2" }; mycmd [2] = new string [] { "p", "0" }; mycmd [3] = new string [] { "v", "5" }; mycmd [4] = new string [] { "e", "1" };  mylist.add (mycmd); exetime [0] = 10;  mlib.doaction (mylist, exetime); 

so there following error : mono.android.runtime.javaobject cannot cast java.lang.string[][]

what wrong?

thanks

i had same problem. in case have next java method:

public int addnotes(long modelid, long deckid, list<string[]> fieldslist, list<set<string>> tagslist) 

in binding library became:

public int addnotes(long p0, long p1, ilist<string[]> p2, ilist<icollection<string>> p3); 

i solved changing type of parameter in binding library string[] java.lang.object adding attr rule in metadata.xml. in case rule (in path attribute need xpath parameter in api.xml):

<attr path="/api/package[2]/class[1]/method[6]//parameter[3]" name="type">java.util.list&lt;java.lang.object&gt;</attr>


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -