I have read both solutions here:
Prevent Activity Stack from being Restored?
But I hope there is a more elegant way to solve this.
Here is where my problem originates. I have an Activity that has a View Pager with Fragments Those fragments are inner classes and for some reason inner Fragments should be static. The fragments however, use a lot of stuff from the parent Activity, that is not static, and cannot be accessed from a static context. I tried passing them as arguments, but one of the arguments is the ViewPager itself and it cannot be serialized or accessed from a static context. If the app has been idle for hours, the Activity is recreated instead of started fresh, and the non-static inner class Fragment crashes.
My activity does not need to remember its state from 5 hours ago. I want it to not be restored whenever the app is brought back to foreground again.