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 22, 2017
1 parent c6cafc5 commit 04d7ace
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 04d7ace

Please sign in to comment.