Tags

I was developing the game using AndEngine. I had two activity Welcome screen(Welcome.java) and Game Screen(Game.java) when user clicks on Start button in Welcome Screen he should be moved to next activity.

I end up with the following code. You can also use the following code to change the activity in AndEngine.

Place this code somewhere on suitable event such as onClick() event after which you want to change the activity.

Welcome.this.startActivity(new Intent(Welcome.this, Game.class));
Welcome.this.finish();

Change the class name to yours and fix the import Error that will occur.

And finally add this code in AndroidManifest.xml before </application>

<activity android:name="com.example.myGame.Game"> </activity>

Don’t forget to change your package name and Class name.