title: Saving MapFragment (Maps v2) State in Android
body: <p>I'm working with the new GoogleMaps API (v2) and have some problems with the fragment. I have two fragments in my app (Map, List) and the user can switch between them. Works fine so far with this code:</p>
  
  <pre><code>if (itemPosition == 0) {
          getSupportFragmentManager().beginTransaction()
                  .replace(R.id.fragmentpos, myMapFragment).commit();
      } else if (itemPosition == 1) {
          getSupportFragmentManager().beginTransaction()
                  .replace(R.id.fragmentpos, myListFragment).commit();
  }......
  </code></pre>
  
  <p>When I work with the map, switch to the list fragment and then back to the map fragment, the last position of the map is not saved. This is not what i want, i want that the map is in the save state as i "left" it..
  How can I accomplish this? I tried to save the camera position in </p>
  
  <pre><code>public void onSaveInstanceState(Bundle outState){
     outState.putDouble("LAT", mMap.getCameraPosition().target.latitude);
     outState.putDouble("LON", mMap.getCameraPosition().target.longitude);
     outState.putFloat("BEAR", mMap.getCameraPosition().bearing);
     ...
  </code></pre>
  
  <p>}</p>
  
  <p>and restore it in onCreateView(), but the Bundle is always null. The onSaveInstanceState is not called if I replace the fragments.</p>
  
  <p>So how can I save the state of the map?</p>