Referring to this site, I built my MapActivity
as following:
public class MainActivity extends Activity {
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView = (MapView) findViewById(R.id.map);
mapView.setComponents(new Components());
RasterDataSource datasource = new PackagedRasterDataSource(new EPSG3857(), 11, 12, "t{zoom}_{x}_{y}", getApplicationContext());
RasterLayer mapLayer = new RasterLayer(datasource, 16);
mapView.getLayers().setBaseLayer(mapLayer);
mapView.setFocusPoint(mapView.getLayers().getBaseLayer().getProjection().fromWgs84(47.0f, 9.0f));
//mapView.setZoom(15);
}
@Override
protected void onStart(){
super.onStart();
mapView.startMapping();
}
@Override
protected void onStop(){
mapView.stopMapping();
super.onStop();
}
}
I have put tiles in my res/raw
folder, but however nothing is shown. Is there anything I am missing? According to the tutorial, it must show something. What else could I provide to debug it? The xml is a simple MapView
with width
and height
.
The tiles are generated here and here. As parameters I set no CloudMade Key.