Finder
Finder

Reputation: 1217

Always open application from Splashscreen in Android

I have 4 Activities.Splash Screen -> Login Screen -> Home Screen -> User Screen. When I am in My Application's Home Screen I had pressed Device HOME Button at that time application going to background. If I open the application again it shows from Application's home screen. Now I need to show Splash then Login Screen for every time.I have called finish() for every Intent calls. How to do this ?

Upvotes: 0

Views: 1631

Answers (3)

Aditya
Aditya

Reputation: 90

Use this for the activity in your AndroidManifest.xml android:launchMode="singleInstance"

Upvotes: 0

amit singh
amit singh

Reputation: 1422

In HomeScreen Activity, write this in onResume()-

Intent intent = new Intent(getApplicationContext(), Spalsh.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);

Upvotes: 2

Hoan Nguyen
Hoan Nguyen

Reputation: 18151

In your manifest file, in the Splash Screen activity (which I assume to be the root activity) add the following line

android:clearTaskOnLaunch="true"

Upvotes: 1

Related Questions