Answer the question
In order to leave comments, you need to log in
Checking called activity?
Own code
...
Intent intent;
...
case (8):
// Избранное
intent = new Intent(getApplicationContext(), FavoriteActivity.class);
break;
case (9):
// Корзина
intent = new Intent(getApplicationContext(), CartActivity.class);
break;
case (12):
// О приложении
intent = new Intent(getApplicationContext(), SupportActivity.class);
break;
default:
break;
}
if (intent != null) {
startActivity(intent);
}
Answer the question
In order to leave comments, you need to log in
1. manually monitoring the stack of activities yourself is not good
2. killing an activity before switching to another one. For example: opened About the application, sent an intent to a new activity, killed About the application
3. read about the flags for launching the activity, you can make the About application always have one in the stack. Not all flags are available in all versions of android.
Do you really need activations? It is possible to work with fragments or pages within one activity ... then other mechanisms will work there.
And what are you checking against getApplicationContext()? You need at least a design
if(this instanceof ClassName)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question