[android] check if the map is destroyed before saving state in a fragment
This commit is contained in:
committed by
Łukasz Paczos
parent
69b7c2fe46
commit
18b43f29cf
@@ -165,7 +165,9 @@ public final class MapFragment extends Fragment implements OnMapReadyCallback {
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
map.onSaveInstanceState(outState);
|
||||
if (map != null && !map.isDestroyed()) {
|
||||
map.onSaveInstanceState(outState);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,7 +185,9 @@ public final class MapFragment extends Fragment implements OnMapReadyCallback {
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
map.onLowMemory();
|
||||
if (map != null && !map.isDestroyed()) {
|
||||
map.onLowMemory();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -160,7 +160,9 @@ public class SupportMapFragment extends Fragment implements OnMapReadyCallback {
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
map.onSaveInstanceState(outState);
|
||||
if (map != null && !map.isDestroyed()) {
|
||||
map.onSaveInstanceState(outState);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +180,9 @@ public class SupportMapFragment extends Fragment implements OnMapReadyCallback {
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
map.onLowMemory();
|
||||
if (map != null && !map.isDestroyed()) {
|
||||
map.onLowMemory();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user