title: How to deal with retained data after Activity comes to foreground when using more than one Activity?
body: <p>At the moment I'm a little bit confused about the lifecycle management in Android. There are at least 4 possibilities to resume retained data after an Activity comes back to the foreground:</p>
  
  <ul>
  <li><p><strong>Android handling:</strong> If there is enough memory, Android stores and resumes the important data (checked radio buttons, text of EditText,-... and so on) after Activity restart, the user has the same state as before as the Activity went into background. </p></li>
  <li><p><strong>onPause, onResume:</strong> Overriding onPause and save the important data to a database or text file and resume it when onResume is executed next time. </p></li>
  <li><p><strong>onSavedInstance(Bundle), onRestoreInstance(Bundle):</strong> I can save the data as key-value-pair into bundles and restore them after onRestoreInstance is executed.</p></li>
  <li><p><strong>onRetainNonConfigurationInstance(), getLastNonConfigurationInstance():</strong> I handle all my storage issues in one big object and read getLastNonConfigurationInstance() out when onCreate is executed.</p></li>
  </ul>
  
  <p>Although it is confusing which approach is best, I guess it relies on development experience to know when to use which possibility. If you have some good examples for each I would be glad, but this is not my question. I wonder how to deal with all that when I have different Activities and one Activity will be killed by Android when it pauses in background:  </p>
  
  <p>In my case I have a MainActivity and a MessageActivity. The MessageActivity consists of a ViewSwitcher which consists of two states. State one is a radio button choice list. State two is an EditText with two buttons (send and abort). When I monkey test each state, hit the Android home button, and restart the application, the right Activity with the right state and the old data comes into foreground, when I leave the handling to Android. So that works.<br>
  But what happens when Android destroys the MessageActivity in background: 
  If I use the Android way, the data is lost and I guess MainActivity (instead of MessageActivity->state(1 or 2)) will start next time after I relaunch the application (is that correct?). So when I'd like to keep the data of MessageActivity, I have to use one of the other three possibilities.<br>
  How to do that neatly, when the application entry point (so the MainActivity) differs from the last active Activity. The problem is that I have to resume a special Activity with a special state of ViewSwitcher. I could start MessageActivity out of MainActivity with startActivity(Intent) in onStart() or onResume() method (because MainActivity is probably the entry point) but then I run into a lot of logical problems in Lifecycle management. Due to this fact I don't think that this is the right way to do that. </p>
  
  <p>But, what's the right and best way to do that?</p>