I have a problem with a particular scenario with my app. The activtiy flow is following:
- SplashScreenActivity (this is my default launcher activity which does some important preloading of external application theme
- When my theme is loaded it automatically goes to next LoginActivity
The problem that is happening is when I leave my app in LoginActivity and put app in background by hitting the home button. In the background I start as many other apps as I can so that I can get phone memory in a critical state and in that way to force Android system to kill my activity in order for the other apps to use this memory.
When this scenario occurs I try to get back to my app that is still in the list of opened apps and when I do that I've read that Android system recreates the last activity that was opened when this memory release occured and that is the moment when my app crashes because it doesn't have some data that was stored in memory.
My question is, is there any way that I can tell or configure the app that when this scenario happens to NOT recreate last activity but to launch my default launcher activity (in this case SplashScreenActivity ) which would normally preload all the necessary data that is used later on in the LoginActivity.
Note I don't need my app to start the SplashScreenActivity every time uses puts application in a background and then goes back to foreground. I need it launch this default activity only when Android system kill's it because it requires some memory.