diff --git a/vtm-android-example/src/org/oscim/android/test/MapFragment.java b/vtm-android-example/src/org/oscim/android/test/MapFragment.java index 327fc651..07b79a63 100644 --- a/vtm-android-example/src/org/oscim/android/test/MapFragment.java +++ b/vtm-android-example/src/org/oscim/android/test/MapFragment.java @@ -30,6 +30,7 @@ import org.oscim.renderer.GLViewport; import org.oscim.scalebar.DefaultMapScaleBar; import org.oscim.scalebar.MapScaleBar; import org.oscim.scalebar.MapScaleBarLayer; +import org.oscim.theme.IRenderTheme; import org.oscim.theme.VtmThemes; import org.oscim.tiling.source.mapfile.MapFileTileSource; @@ -42,6 +43,7 @@ import java.io.File; public class MapFragment extends Fragment { private MapView mapView; + private IRenderTheme theme; public static MapFragment newInstance() { MapFragment instance = new MapFragment(); @@ -79,7 +81,7 @@ public class MapFragment extends Fragment { mapView.map().layers().add(new LabelLayer(mapView.map(), tileLayer)); // Render theme - mapView.map().setTheme(VtmThemes.DEFAULT); + theme = mapView.map().setTheme(VtmThemes.DEFAULT); // Scale bar MapScaleBar mapScaleBar = new DefaultMapScaleBar(mapView.map()); @@ -110,6 +112,10 @@ public class MapFragment extends Fragment { @Override public void onDestroyView() { + if (theme != null) { + theme.dispose(); + theme = null; + } if (mapView != null) { mapView.onDestroy(); mapView = null;