My app shows a signup activity the first time the user runs the app, looks like:
so the activities launch each other in exactly that order, when the user clicks through a button on each screen.
When the user goes from activity #2 to #3, is it possible to wipe #1 and #2 off the history stack completely? I'd like it so that if the user is at #3, and hits the back button, they just go to the homescreen, instead of back to the splash screen.
I think I can accomplish this with tasks (ie. start a new task on #3) but wanted to see if there was simpler method,
Thanks
The easiest way is to give the LoginActivity a “android:noHistory = true” attribute in the manifest file. That instructs Android to remove the given activity from the history stack thereby avoiding the aforementioned behavior altogether.
On your Android phone or tablet, go to myactivity.google.com. Above your activity, tap Delete . Tap All time. Delete.
startActivity(intent); It will totally clears all previous activity(s) and start new activity.
Declare Activity A as SingleTop by using [android:launchMode="singleTop"] in Android manifest. Now add the following flags while launching A from anywhere. It will clear the stack.
You can achieve this by setting the android:noHistory
attribute to "true"
in the relevant <activity>
entries in your AndroidManifest.xml
file. For example:
<activity android:name=".AnyActivity" android:noHistory="true" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With