diff --git a/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java b/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java index 93731f06..493f91d7 100644 --- a/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/BaseMapActivity.java @@ -47,7 +47,7 @@ public class BaseMapActivity extends MapActivity { mTileSource = new OSciMap4TileSource(); if (USE_CACHE) { - mCache = new TileCache(this, "cachedir", "testdb"); + mCache = new TileCache(this, null, "tile.db"); mCache.setCacheSize(512 * (1 << 10)); mTileSource.setCache(mCache); } diff --git a/vtm-android-example/src/org/oscim/android/test/BitmapTileMapActivity.java b/vtm-android-example/src/org/oscim/android/test/BitmapTileMapActivity.java index f59c2557..afd73c4c 100644 --- a/vtm-android-example/src/org/oscim/android/test/BitmapTileMapActivity.java +++ b/vtm-android-example/src/org/oscim/android/test/BitmapTileMapActivity.java @@ -16,14 +16,21 @@ package org.oscim.android.test; import org.oscim.android.MapActivity; import org.oscim.android.MapView; +import org.oscim.android.cache.TileCache; import org.oscim.layers.tile.BitmapTileLayer; -import org.oscim.tiling.source.bitmap.DefaultSources.OpenStreetMap; +import org.oscim.tiling.source.TileSource; +import org.oscim.tiling.source.bitmap.DefaultSources; import android.os.Bundle; public class BitmapTileMapActivity extends MapActivity { + + private final static boolean USE_CACHE = true; + MapView mMapView; + private TileCache mCache; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -32,11 +39,22 @@ public class BitmapTileMapActivity extends MapActivity { mMapView = (MapView) findViewById(R.id.mapView); registerMapView(mMapView); - mMap.getLayers().add(new BitmapTileLayer(mMap, new OpenStreetMap(), 20)); - //mMap.getLayers().add(new BitmapTileLayer(mMap, new ImagicoLandcover(), 20)); - //mMap.getLayers().add(new BitmapTileLayer(mMap, new ArcGISWorldShaded(), 20)); - //mMap.getLayers().add(new BitmapTileLayer(mMap, new HillShadeHD(), 20)); + TileSource tileSource = new DefaultSources.OpenStreetMap(); + + if (USE_CACHE) { + mCache = new TileCache(this, null, tileSource.getClass().getSimpleName()); + mCache.setCacheSize(512 * (1 << 10)); + tileSource.setCache(mCache); + } + mMap.getLayers().add(new BitmapTileLayer(mMap, tileSource)); mMap.setMapPosition(0, 0, 1 << 2); } + + @Override + protected void onDestroy() { + super.onDestroy(); + if (USE_CACHE) + mCache.dispose(); + } }