I am trying to use the starting another activity intent in AndEngine as I use it in my original Android apps, it doesn't work.
Logcat :
02-19 18:32:49.682: E/AndroidRuntime(1794): FATAL EXCEPTION: main
02-19 18:32:49.682: E/AndroidRuntime(1794): java.lang.NullPointerException
02-19 18:32:49.682: E/AndroidRuntime(1794): at org.andengine.ui.activity.BaseGameActivity.onResumeGame(BaseGameActivity.java:222)
02-19 18:32:49.682: E/AndroidRuntime(1794): at org.andengine.ui.activity.BaseGameActivity$4.run(BaseGameActivity.java:373)
02-19 18:32:49.682: E/AndroidRuntime(1794): at android.os.Handler.handleCallback(Handler.java:730)
02-19 18:32:49.682: E/AndroidRuntime(1794): at android.os.Handler.dispatchMessage(Handler.java:92)
02-19 18:32:49.682: E/AndroidRuntime(1794): at android.os.Looper.loop(Looper.java:137)
02-19 18:32:49.682: E/AndroidRuntime(1794): at android.app.ActivityThread.main(ActivityThread.java:5289)
02-19 18:32:49.682: E/AndroidRuntime(1794): at java.lang.reflect.Method.invokeNative(Native Method)
02-19 18:32:49.682: E/AndroidRuntime(1794): at java.lang.reflect.Method.invoke(Method.java:525)
02-19 18:32:49.682: E/AndroidRuntime(1794): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
02-19 18:32:49.682: E/AndroidRuntime(1794): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
02-19 18:32:49.682: E/AndroidRuntime(1794): at dalvik.system.NativeStart.main(Native Method)
code :
startActivity(new Intent(StartingActivity.this, MainActivity.class));
finish();
Note that sometimes it works and sometimes doesn't.
@Override
public synchronized void onResumeGame() {
if (this.mEngine != null)
super.onResumeGame();
}
solved it by using this code, referrence https://github.com/nicolasgramlich/AndEngine/issues/7
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.