Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create ArrayList<String> Object in JNI

I have a callback method in Java which is called by a native thread. One of the parameter of callback is an ArrayList object.

I am not able to get classref for ArrayList and its methods. Tried with "Ljava/util/ArrayList" but in vain. Please suggest a solution. thanks in advance

like image 323
Avinash Avatar asked Nov 05 '22 18:11

Avinash


1 Answers

The class reference would be:

jclass cls = (*env)->FindClass(env, "java/util/ArrayList");

OR

jclass cls = (*env)->FindClass(env, "Ljava/util/ArrayList;");

You have an extra L in front of the java/util/ArrayList. In that case you also need to append a ;.

like image 105
maba Avatar answered Dec 01 '22 04:12

maba