I produce the game by using the version of cocos2d-2.1rc0-x-2.1.3.
Phenomenon that screen comes out black when I was working on Android has occurred.
When the game is started, the menu screen will be output properly.
In jni in order to take advantage of facebook menu, the in-app-billing
I will call the activity.
After the call, facebook, in-app-billing screen is displayed correctly.
Exit activity facebook, to in-app-billing available,
When you return to the menu screen of the game, the menu screen is displayed in black.
On the screen that is black, and when I pressed to guess the position of the button,
A new screen will be displayed correctly.
Only when using the activity by using jni, but it looks black,
Why not? Can you how to fix?
c + + code
————————————————— —————————
JavaVM * jvm = JniHelper :: getJavaVM ();
JNIEnv * env;
jvm~~> GetEnv & env, JNI_VERSION_1_4);
CCLog ;
jclass cls;
cls = env~~> FindClass (“co / kr / cnsolution / gogodol / FacebookManager”);
/ / Type 0: user (id, name, token)
/ / Type 1: friend list
/ / Type 2: send heart (to: userid)
/ / Type 3: invite friend (to: userid)
jmethodID method = env-> GetStaticMethodID (cls, “facebookSendHeart”, “(Ljava / lang / String V”);
jstring userid = env~~> NewStringUTF ;
env~~> CallStaticVoidMethod (cls, method, userid);
————————————————— ——————————
java code
————————————————— ——————————-
public class FacebookManager extends Cocos2dxActivity
{
private Session facebookSession = null;
private int infomationType = 0;
private String toUserid = “”;
public native void nativeFacebookUser (String userId, String userName, String appToken);
public native void nativeFacebookFriends (String userId, String userName, String userUrl);
public static void facebookInfomation (final int type)
{
Log.d (“FacebookManager”, “start facebookLogin” + String.format (“type: d", type));
Cocos2dxActivity activity = (Cocos2dxActivity) Cocos2dxActivity.getContext ();
activity.runOnUiThread (new Runnable ()
{
@ Override
public void run ()
{
Intent intent = new Intent (Cocos2dxActivity.getContext (), FacebookManager.class);
intent.putExtra (“type”, type);
intent.putExtra (“to”, “”);
Cocos2dxActivity.getContext (). startActivity (intent);
}
});
Log.d (“FacebookManager”, “end facebookLogin”);
}
public static void facebookSendHeart (final String userID)
{
Log.d (“FacebookManager”, “start facebookLogin” + String.format ("type: d”, 3));
Cocos2dxActivity activity = (Cocos2dxActivity) Cocos2dxActivity.getContext ();
activity.runOnUiThread (new Runnable ()
{
@ Override
public void run ()
{
Intent intent = new Intent (Cocos2dxActivity.getContext (), FacebookManager.class);
intent.putExtra (“type”, 2);
intent.putExtra (“to”, userID);
Cocos2dxActivity.getContext (). startActivity (intent);
}
});
Log.d (“FacebookManager”, “end facebookLogin”);
}
protected void onCreate (Bundle savedInstanceState)
{
super.onCreate (savedInstanceState);
Intent intent = getIntent ();
infomationType = intent.getIntExtra (“type”, 0);
toUserid = intent.getStringExtra (“to”);
Message msg = m_Handler.obtainMessage ();
msg.what = 0;
m_Handler.sendMessageDelayed (msg, 1000);
}