+ //setting this before the layout is inflated is a good idea
+ //it 'should' ensure that the map has a writable location for the map cache, even without permissions
+ //if no tiles are displayed, you can try overriding the cache path using Configuration.getInstance().setCachePath
+ //see also StorageUtils
+ //note, the load method also sets the HTTP User Agent to your application's package name, abusing osm's tile servers will get you banned based on this string
+
+ //inflate and create the map
+ setContentView(R.layout.activity_map);
+
+ map = (MapView) findViewById(R.id.map);
+ map.setTileSource(TileSourceFactory.MAPNIK);
+
+ // add ability to zoom with 2 fingers
+ map.setMultiTouchControls(true);
+
+
+ Bundle b = getIntent().getExtras();
+ double lat = -1;
+ double lon = -1;
+ GeoPoint marker = null;
+ if(b != null) {
+ lat = b.getDouble("lat");
+ lon = b.getDouble("lon");
+ marker = new GeoPoint(lat, lon);
+ }
+ startMap(marker);
+ }
+
+ public static void startMap(GeoPoint marker) {
+ // move the map on the marker position or on a default view point: Turin, Piazza Castello