title: Retain the Fragment object while rotating
body: <p>I have developed an app in Honeycomb and I am using fragments.<br>
  This is my app </p>
  
  <ul>
  <li>I have an Activity (Say A1) and in that there is a fragment  </li>
  <li>Initially this fragment hold the object one fragment object say (F1)</li>
  <li>Then depending on the user actions it may change to other objects F2,F3 ....  </li>
  </ul>
  
  <p><strong>What my problem is</strong>   </p>
  
  <p>When The user rotate the device the activity is recreated and which make F1 as the fragment object even though before rotating it wasn't<br>
  <em><code>What is the way to retain the fragment object while rotating?</code></em><br>
  I used <code>setRetainInstance(true);</code> but it didn't work for me<br>
  And I have added the fragment by code in my <code>onCreate</code> function like this    </p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
  
     FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
  
     Fragment homeFragment = new Home();
     fragmentTransaction.add(R.id.mainFragement, homeFragment);
     fragmentTransaction.commit();
  }
  </code></pre>