I have a MainActivity
class, which launches a RaceActivity
at some point. If, later, the RaceActivity
exits, I want the MainActivity
to return, with all its views. However, it seems to be created anew each time. I have implemented the proper section of onOptionsItemSelected
, but when I click the back button, I get a new instance each time, or at least the programmatically added views are gone. What can I do to fix this?
Edit for clarification:
I am fine using onCreate with a bundle to restore these views, but I thought that happened automatically if you recreate the same instance of an object. I want to keep programmatically created views when the activity is recreated. Alternatively, I want the activity to stop being destroyed when the user returns to it. (I tested, and it gets destroyed as soon as the use returns.)