I want to improve the performance of SupportMapFragment when the device is rotated. It seems that the fragment should be recreated. I am not sure about this, however, when the device is rotated, the map tiles must be rebooted. It would be prudent in terms of performance to have the entire wireframe fragment stored and reused without the need for a re-instance of the fragment. Any understanding of this would be appreciated.
I declare SupportMapFragment in xml and using SetupMapIfNeeded () as described in api docs.
private void setUpMapIfNeeded() { // Do a null check to confirm that we have not already instantiated the // map. if (mMap == null) { // Try to obtain the map from the SupportMapFragment. mMap = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); // Check if we were successful in obtaining the map. if (mMap != null) { setUpMap(); } } }
Patrick
source share