I have an application that has an initial activity (A - also the one specified in the launcher) from which it allows the user to launch another activity (B). I am saving the
This is because another instance of app is launching when icon is pressed.
// To prevent launching another instance of app by clicking app icon
if (!isTaskRoot()
&& getIntent().hasCategory(Intent.CATEGORY_LAUNCHER)
&& getIntent().getAction() != null
&& getIntent().getAction().equals(Intent.ACTION_MAIN)) {
finish();
return;
}
write the above code in your launcher activity before calling setContentView. This will solve the problem