0

I added a google Map programmatically to a fragment (let's say fragment F1).

The fragment has this in its onCreate():

    mMapFragment = SupportMapFragment.newInstance();

this in its onCreateView:

FragmentTransaction fragmentTransaction= getFragmentManager().beginTransaction();
        fragmentTransaction.add(R.id.act_complete_track_f1_frameLayout, mMapFragment);
        fragmentTransaction.commit();

and this in its onStart()

this.mMap= mMapFragment.getMap();
        if(mMap == null){
            //controllo se sul dispositivo si e' riusciti ad ottenere un google maps service (es: assenza di permessi, componenti di google play services mancanti).
            //Nel caso non fossimo riusciti, elimino la mappa per un graceful degradation
            getView().findViewById(R.id.act_complete_track_f1_frameLayout).setVisibility(View.GONE);
        }

Now: if I interact with the map, everything works. But if the main fragment is recreated (for example by rotating the phone), the map is redrawn BUT it's not responsive anymore: I can click the zoom buttons, but nothing happens for example.

Why is that? How can I handle this?

Bertuz
  • 2,390
  • 3
  • 25
  • 50

0 Answers0