JNI on Android, how to pass int from c to java

Posted by Joaquin on Stack Overflow See other posts from Stack Overflow or by Joaquin
Published on 2010-12-27T21:48:50Z Indexed on 2010/12/27 21:54 UTC
Read the original article Hit count: 229

Filed under:
|
|
|

I have a C function, I simply returns an integer, as follows:

 JNIEXPORT jint JNICALL Java_org_project_ScreenPosition(JNIEnv* env, jobject thiz){
   int i=1;
   return i;
 } 

I call this function in the way of an Activity onCreateContextMenu Android, as follows:

public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo){
 menu.setHeaderTitle("TryMenu");

 int a=ScreenPosition();
 return;
}

But all crash

© Stack Overflow or respective owner

Related posts about java

Related posts about android