I have an issue with my app when starting an SimpleBaseGameActivity from another SimpleBaseGameActivity. The code is:
Intent intent = new Intent(MainMenuActivity.this, PacManActivity.class);
intent.putExtra(INTENT_LEVEL_NUMBER, levelNumber);
intent.putExtra(INTENT_WORLD_NUMBER, worldNumber);
startActivity(intent);
It runs good, but when it loads the other Activity (PacManActivity) it throws an exception:
FATAL EXCEPTION: main
java.lang.NullPointerException
at org.andengine.ui.activity.BaseGameActivity.onResumeGame(BaseGameActivity.java:220)
at org.andengine.ui.activity.BaseGameActivity$4.run(BaseGameActivity.java:371)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
I’m not even implemented onResumeGame() method and if I start my PacManActivity by default (configured from Manifest.xml) it runs without any error.
Could someone please help me with this problem.
You need to set the following value in your AndroidManifest file for your
Activity…This is a known bug/issue in AndEngine…
https://github.com/nicolasgramlich/AndEngine/issues/7