title: Keep state of Activity UI after leaving and reentering it in Android-App
body: <p>In my Android App I have a main activity and some other activities. The others get started with a button from the main one.</p>
  
  <p>When I enter an activity and for example toggle some toggleViews, return back to main view and then again enter the sub activity, <strong>all the changes are lost</strong>.</p>
  
  <p>Changing the <code>manifest.xml</code> to</p>
  
  <pre><code>    &lt;activity android:name="MySubActivity"
              android:launchMode="singleTask" &gt;
      &lt;/activity&gt;
  </code></pre>
  
  <p>does not help.</p>
  
  <p>Also the Methods <code>onSaveInstanceState</code> and <code>onRestoreInstanceState</code> do not work because the sub activity gets killed as soon as I leave it. So the data is saved but it can never be loaded because the Bundle of <code>onCreate(Bundle savedInstanceState)</code> seems to be always <code>null</code>.</p>
  
  <p>How can I keep the status of all the inputs (<em>better</em>) or prevent the activity from getting killed (<em>worse</em>)?</p>