title: Android application not working after resuming activity
body: <p>I have an application where whenever I exit the application via the home hardware button, it should return to the last state the application is in. However, when I launch the application again, the application shows a white screen with only my header bar. And when I click on the header bar's button, the application crashes with the <code>IllegalStateException</code> where the application cannot find the method for the button clicked. </p>
  
  <p>I am currently implementing with Sherlocks Fragment, where the header bar is an action bar. I'm also using HTC Rhyme, Version 2.3 (Gingerbread). The following is the codes for the addition of fragments into my main app.</p>
  
  <p>Codes to add the fragments within the onCreate method in the activity:</p>
  
  <pre><code>FragmentTransaction trans = getSupportFragmentManager().beginTransaction();
  Bundle bMain = getIntent().getExtras();
  String statusCheck = "";
  if (bMain != null) {
      statusCheck = bMain.getString("statusCheck");
  }
  if (statusCheck.equals("web")) {
      MyWebViewFragment webfrag = new MyWebViewFragment();
      trans.add(R.id.container,webfrag, "WebViewFragment");
  } else if(statusCheck.equals("traveloguelist")) {
      MyTravelogueListFragment travelfrag = new MyTravelogueListFragment();
      trans.add(R.id.container,travelfrag, "TravelogueListFragment");
  }
  trans.commit();
  </code></pre>
  
  <p>This is the codes when I change a fragment:</p>
  
  <pre><code>MyTravelogueListFragment travelfrag = new MyTravelogueListFragment();
  getSupportFragmentManager().beginTransaction().replace(R.id.container, travelfrag).addToBackStack(null).commit();
  </code></pre>
  
  <p><strong>[Edit]</strong></p>
  
  <p>I realized after much reading and running that the main issuei have is that upon resuming the application, the activity is actually created again. Thus, some of the parameters i passed in does not get registered, resulting in the wrong display. I <em>THINK</em> this is the error that is causing that to happen: </p>
  
  <pre><code>Previously focused view reported id "myresID" during save, but can't be found during restore.
  </code></pre>
  
  <p>However, I don't know how you force the application to remember the previous state of the fragment? Or is there any other way around this problem?</p>
  
  <p>I'm still very stuck with this problem. Will really appreciate it if someone can help me! </p>