MduSenthil
MduSenthil

Reputation: 2077

Launch activity from main activity and return to main activity

How to launch an activity from main activity and return to main activity after an exit operation in sub activity return to main activity?

I have made the sub-activity as launcher intent activity. So after installing the application i have two icons in applications menu, one for main activity and another for sub activity.

Please help me resolve the above issue.

Upvotes: 0

Views: 659

Answers (2)

romy_ngo
romy_ngo

Reputation: 1061

I think you should use only one activity as launcher intent in manifest.xml. Assuming that main activity is the launcher intent, from here you call startActivity(Intent) to get to the next activity. When the job performed by the sub activity is finished, call finish() to bring the main activity back to foreground

Upvotes: 2

Anass
Anass

Reputation: 6270

Add finish in all others activities, when you'll return, main activity will be called

Intent intent = new Intent(activity1.this, activity2.class);
startActivity(intent);
// To Kill the intent 
finish();

Sorry for my bad english !

Upvotes: 0

Related Questions