Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I finally found the correct fix for this. Since I was using maps in a Fragment in a two pane layout; I had to programmatically construct the map instead of defining in xml. This is demonstrated in the maps example ProgrammaticDemoActivity in android SDK (googleplayservices). Below is excerpt from the example, this is called from <code>onCreateView</code> when called from a Fragment (or <code>onCreate</code> if you're calling from an <code>Activity</code>):</p> <pre><code>// It isn't possible to set a fragment's id programmatically so we set a tag instead and // search for it using that. mMapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentByTag(MAP_FRAGMENT_TAG); // We only create a fragment if it doesn't already exist. if (mMapFragment == null) { // To programmatically add the map, we first create a SupportMapFragment. mMapFragment = SupportMapFragment.newInstance(); // Then we add it using a FragmentTransaction. FragmentTransaction fragmentTransaction = getSupportFragmentManager() .beginTransaction(); fragmentTransaction.add(android.R.id.content, mMapFragment, MAP_FRAGMENT_TAG); fragmentTransaction.commit(); } </code></pre> <p>The reason this is so because by default the map fragment will have it's own life cycle and not tied to the view life cycle. So if you define it in xml the map fragment is not destroyed but the view is destroyed. This causes an error when you try to inflate the fragment again since the map is already present! See this for more info: <a href="https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapFragment" rel="nofollow">https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapFragment</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload