I need to know a generic way to distinguish between a call of activity from launcher and a call from another activity from inside my app, or a BACK on the activity stack
In the onCreate of your Activity, call getIntent()
. If the Activity is started from the launcher (home screen) the values for getAction()
will be android.intent.action.MAIN
and the getCategories()
will return a set which will contain the android.intent.category.LAUNCHER category.
If the activity is started from elsewhere these values may be null
.