"Don't Keep Activities" - are you aware of this must turn-on developer setting in your Android device?
Not sure about you. The first time I saw this in the developer setting, I laughed out wondering why on earth a developer would want to do this, assuming that this would hide the app performance issues.
I was so damn wrong. Contrary to my assumption, turning on this developer setting actually helps you identify performance issues. It helps you identify memory leaks of an activity.
Where do I find this? See picture attached.
How it works? When the developer option - Don't Keep Activities - is checked-on, in the device, all activities that are stopped will be destroyed almost immediately. It simulates the Android Operating System behaviour when your app is in the background and the system is short on memory; because of which it will destroy your background activities.
How is it useful? It is intended to help developers debug their apps for testing saved instance states and detecting memory leaks.
When to use it? Turn it on - always. If you find any unexpected behaviour of your app like freezes and force closures, it is a sign of bad code that requires fix.
1. Knowledge boost for junior Android developers — Part I
2. Don't keep activities - What is it for?