Skip to content Skip to sidebar Skip to footer

Flag_activity_launched_from_history Not Set In Nexus 10 (android 4.4.2)

I have a main activity A which will call another activity B whose oncreate() is mentioned below. When I press home button while in activity B and press recent apps, the flag FLAG_

Solution 1:

I think you are confused. If your main activity starts ActivityB, then ActivityB.onCreate() will be called and Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY will not be set. Now, with ActivityB in the foreground, you press the HOME button. This task is pushed to the background. Later the user opens the list of recent tasks and selects your application. The task (with ActivityB on top) is simply brought to the foreground. ActivityB is not recreated, therefore Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY will still not be set. ActivityB.onCreate()` is not called again.

Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY is only set if Android creates a new instance of your activity when the user selects the app from the list of recent tasks. In most cases, this will be when the user starts your application again (from the beginning) after all your activities have finished.

Post a Comment for "Flag_activity_launched_from_history Not Set In Nexus 10 (android 4.4.2)"