osmdroid地图瓷砖显示空白

时间:2013-07-27 16:39:08

标签: java android osmdroid

我是osmdroid的新手并试图在android中显示地图,它没有显示地图只显示空白的地块,也没有显示缩放控制。

我的代码:

public class MainActivity extends Activity {

private MapView m_mapView; 
private int MAP_DEFAULT_ZOOM = 16; 
private double MAP_DEFAULT_LATITUDE =  33.6667; 
// Default map Longitude: 
private double MAP_DEFAULT_LONGITUDE = 73.1667;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main); 
    m_mapView = (MapView) findViewById(R.id.mapview); 
   // m_mapView.setTileSource(TileSourceFactory.MAPQUESTOSM); 
    m_mapView.setTileSource(TileSourceFactory.MAPNIK);
    m_mapView.setBuiltInZoomControls(true); 
    m_mapView.setMultiTouchControls(true); 
    m_mapView.setClickable(true); 
    m_mapView.setUseDataConnection(true); 
    m_mapView.getController().setZoom(16); 
   m_mapView.getController().setCenter(new GeoPoint(33.6667, 73.1667)); 
}

我在AndroidManifest中添加了这个,xml也是

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

<uses-feature android:name="android.hardware.location.network" />
<uses-feature android:name="android.hardware.location.gps" />   
<uses-feature android:name="android.hardware.wifi" />

1 个答案:

答案 0 :(得分:1)

您必须将其添加到 AndroidManifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />