k0rtin
k0rtin

Reputation: 11

Android - Call Main Class Activity

I would like to go back to the Main Activity at a certain point in my application. I tried calling the Activity in an Intent as usual, however since the Activity name for the main class is called "android.intent.action.MAIN", which is the general name of every application's main activity, a "Complete Action Using:" menu pops up with every possible application on the phone as an option. I do not want this; what I want is that the main activity for my application loads up.

How can I achieve this?

Thank you in advance!

Upvotes: 0

Views: 1376

Answers (1)

Bryan Herbst
Bryan Herbst

Reputation: 67259

You can also specify a specific Activity to launch like so:

Intent nextActivityIntent = new Intent(this, MyActivity.class);
startActivity(nextActivityIntent);

As per the Intent documentation, the ACTION_MAIN flag is used to specify that you want to launch an application using the application's main entry point. You generally do not use it in your app unless you are trying to open another app.

Upvotes: 2

Related Questions