I have a main activity, that when I click on a button, starts a new activity, i used the following code to do so:
Intent intent = new Intent(this, SettingsAc
You have to use this in your MainActivity
Intent intent = new Intent(context , yourActivity);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
context.startActivity(intent);
The flag will start multiple tasks that will keep your MainActivity, when you call finish it will kill the other activity and get you back to the MainActivity