I am searching for a tutorial/manual or steps to include Open street map into my android application. All I found is either a big project with lot more functionality on it, othe
I don't know of any tutorials but here's the code I wrote for a minimal example using Osmdroid.
// This is all you need to display an OSM map using osmdroid
package osmdemo.demo;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapController;
import org.osmdroid.views.MapView;
import android.app.Activity;
import android.os.Bundle;
public class OsmdroidDemoMap extends Activity {
private MapView mMapView;
private MapController mMapController;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.osm_main);
mMapView = (MapView) findViewById(R.id.mapview);
mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
mMapView.setBuiltInZoomControls(true);
mMapController = (MapController) mMapView.getController();
mMapController.setZoom(13);
GeoPoint gPt = new GeoPoint(51500000, -150000);
mMapController.setCenter(gPt);
}
}
/* HAVE THIS AS YOUR osm_main.xml
---------------------------------------------------------- XML START
---------------------------------------------------------- XML END
Include slf4j-android-1.5.8.jar and osmdroid-android-4.1.jar in the build path
(Google search for where to get them from)
*/
Note that you must now use the latest version (4.1) to avoid getting blocked from downloading tiles from OSM.
Also note that they are moving their repositries to Github and the process isn't complete yet. This page downloads holds the links for the jars