Scenario is: Activity with singleTop declared at the manifest. This activity is called with some extras. I'm able to clear the intent data and be able to flip screen and such without the original intent being called...
The issue is that when the activity is killed by the system and the user goes back to this activity it gets restarted using the original intent used to create the activity.
How do I remove this? I tried starting the same activity from within with a new Intent but no luck... I have also used various flags.
On Clicking the back button from the New Activity, the finish() method is called and the activity destroys and returns to the home screen.
FLAG_ACTIVITY_CLEAR_TOP. If the activity being started is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it are destroyed and this intent is delivered to the resumed instance of the activity (now on top), through onNewIntent() ).
The easiest way to do this would be to pass the session id to the signout activity in the Intent you're using to start the activity: Intent intent = new Intent(getBaseContext(), SignoutActivity. class); intent. putExtra("EXTRA_SESSION_ID", sessionId); startActivity(intent);
launchMode — singleTask | flag — FLAG_ACTIVITY_NEW_TASK: If an Activity do not exist in an already created Task, then it starts the Activity in a new Task with Activity's new instance at the root of the Task's back stack, else the Task is brought forward with the Activity's last state restored and this Activity ...
Well turns out that there isn't a proper way to clear intent data from the ActivityManager. The only way around this bug is to keep a flag state for when extras have been cleared. Please see the following post about keeping a flag. https://groups.google.com/forum/#!topic/android-developers/vrLdM5mKeoY
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