I’m trying to discern, during onStart(), whether my Activity was started from the home screen or “back” from another activity.
getIntent().hasCategory("android.intent.category.LAUNCHER")
does not work, as the activity’s intent stays the same.
I want to display a dialog box when the main activity starts, but I don’t want it popping up every time a user goes back to the main activity after visiting another.
Is there any way to accomplish this?
Thanks for any help!
-Chase
Yes it is possible to launch a dialog box only when the main activity starts the first time, but I save state on a soft kill. So if you save state in onSaveInstanceState on a soft kill you can look for a null bundle in onCreate. If the bundle is null, then this is the first launch. If the bundle is not null, then you are returning from a soft kill. If you save state in onRetainNonConfigurationState then the code looks like: