Move to Next Activity in AndEngine (Android)

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.