firstly I save JVM pointer in a native function which called when ap
lauched:
JNIEXPORT void JNICALL Java_com_caval_ServerList_Init
(JNIEnv * env, jobject obj)
{
...
*// save jvm pointer*
* **int nRt = env->GetJavaVM(&jvm);*
if (nRt == 0)
fprintf(stdout, "InitDLNACP --> GetJavaVM Success...\n");
else
fprintf(stderr, "InitDLNACP --> GetJavaVM Failed...\n");
}
then, when some event echoed I will make a callback of some class in jvm
void _callback()
{
JNIEnv *env = NULL;
int nResult = -1;
*nResult = jvm->AttachCurrentThread((void **)&env, NULL);*
*if ((nResult != 0) || (env == NULL))*
{
fprintf(stderr, "--> In _Java_com_caval_now_Map_AddItem Thread Attached
Failed.\n");
return;
}
jstring ret = env->NewStringUTF(pszTitle); // I run to this line and ap
crashed.
jclass cls = env->FindClass("com/caval/now/ServerList");
}
the AttachCurrentThread func return OK and also I get the env pointer.
but any call on env will crash.
I have no idea of this issue...any help will highly appriciated.
Regards,
Caval.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---