This topic is continue of this: Android. How to start activity without creating new one?
I have read that activities are destroyed when to click BACK button. They can be
You can redefine the "onBack" method of your activity, something like
public void onBackPressed ()
{
moveTaskToBack (true);
}
The default implementation of the back button is the finish the current activity. You may however intercept that key press and do whatever you wish with it. For instance, instead of finishing your current activity, you could "bring up" the previous activity and thus making it seem as if the normal implementation is at hand.
To intercept the back button press: Android: intercepting back key
And to start your previous activity without creating a new one every time:
Intent i = new Intent(this, PreviousActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(i);
In Kotlin 1.2:
val intent = Intent(this, RepairListActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
startActivity(intent)
Good luck.