Closing app through JNI doesn't work.

Closing app through JNI doesn't work.
0.0 0


Hi everyone, I’m facing with the following problem.
I bind the back key in android, when the user press
that key, the app launch a new activity (popup).
the popup has a title (“closing app”) and 2 buttons (yes/no).
if the user press “no”, the activity returns control to cocos2d-x, perfect.
but if the user press “yes”, the app try to close, but after it’s reopening.

some of my code:

        btnExit.setOnClickListener(new OnClickListener() {  
            public void onClick(View arg0) {

                 public static native void exitGame();
extern "C" {
    JNIEXPORT void JNICALL Java_bla_blabla_blablabla_ExitPopupActivity_exitGame(JNIEnv *, jclass)

void Layer::keyBackClicked() {
        JniMethodInfo minfo;
        bool isHave = JniHelper::getStaticMethodInfo(minfo,"bla/blabla/blablabla/blablablabla", "getMainActivity", "()Ljava/lang/Object;"); 
        jobject jobj = minfo.env->CallStaticObjectMethod(minfo.classID, minfo.methodID);

        isHave = JniHelper::getMethodInfo(minfo, "bla/blabla/blablabla/blablablabla", "showExitPopup", "()V"); 
        if (isHave) {
            minfo.env->CallVoidMethod(jobj, minfo.methodID);