Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] fix map in dialog activity
Browse files Browse the repository at this point in the history
  • Loading branch information
ivovandongen committed Sep 21, 2017
1 parent 5dca8c8 commit 5a00a68
Showing 1 changed file with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.mapbox.mapboxsdk.testapp.activity.maplayout;

import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
Expand Down Expand Up @@ -65,6 +67,22 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
mapView.onCreate(savedInstanceState);
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new Dialog(getActivity(), getTheme()) {
boolean destroyed = false;
@Override
public void dismiss() {
if (mapView != null && !destroyed) {
mapView.onDestroy();
destroyed = true;
}
super.dismiss();
}
};
}

@Override
public void onStart() {
super.onStart();
Expand All @@ -89,12 +107,6 @@ public void onStop() {
mapView.onStop();
}

@Override
public void onDestroy() {
super.onDestroy();
mapView.onDestroy();
}

@Override
public void onLowMemory() {
super.onLowMemory();
Expand Down

0 comments on commit 5a00a68

Please sign in to comment.