2017-02-07 76 views
0

我在API 22上有一些問題,但它在API 23上效果不錯我沒有看到地圖,我只能看到我放置的標記。它的舊版本的Android它的作品。Java android打開街道地圖不顯示地圖

在日誌中我有:

Thread-27428(ApacheHTTPLog):isSBSettingEnabled false 
Thread-27428(ApacheHTTPLog):isShipBuild true 
Thread-27428(ApacheHTTPLog):getDebugLevel 0x4f4c 
Thread-27428(ApacheHTTPLog):Smart Bonding Setting is false 
Thread-27428(ApacheHTTPLog):SmartBonding Setting is false, SHIP_BUILD is true, log to file is false, DBG is false, DEBUG_LEVEL (1-LOW, 2-MID, 3-HIGH) is 1 

AndroidOpenStreetMapViewActivity.java

public class AndroidOpenStreetMapViewActivity extends Activity { 

    private MapView myOpenMapView; 
    private MapController myMapController; 

    ArrayList<OverlayItem> anotherOverlayItemArray; 

    /** 
    * Called when the activity is first created. 
    */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 

     myOpenMapView = (MapView) findViewById(R.id.openmapview); 
     myOpenMapView.setBuiltInZoomControls(true); 
     myMapController = (MapController) myOpenMapView.getController(); 
     myMapController.setZoom(2); 
      //--- Create Another Overlay for multi marker 
     anotherOverlayItemArray = new ArrayList<>(); 
     anotherOverlayItemArray.add(new OverlayItem(
       "0, 0", "0, 0", new GeoPoint(0, 0))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "US", "US", new GeoPoint(38.883333, -77.016667))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "China", "China", new GeoPoint(39.916667, 116.383333))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "United Kingdom", "United Kingdom", new GeoPoint(51.5, -0.116667))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "Germany", "Germany", new GeoPoint(52.516667, 13.383333))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "Korea", "Korea", new GeoPoint(38.316667, 127.233333))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "India", "India", new GeoPoint(28.613333, 77.208333))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "Russia", "Russia", new GeoPoint(55.75, 37.616667))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "France", "France", new GeoPoint(48.856667, 2.350833))); 
     anotherOverlayItemArray.add(new OverlayItem(
       "Canada", "Canada", new GeoPoint(45.4, -75.666667))); 

     ItemizedIconOverlay<OverlayItem> anotherItemizedIconOverlay 
       = new ItemizedIconOverlay<OverlayItem>(
       this, anotherOverlayItemArray, null); 
     myOpenMapView.getOverlays().add(anotherItemizedIconOverlay); 
     //--- 

     //Add Scale Bar 
     ScaleBarOverlay myScaleBarOverlay = new ScaleBarOverlay(this); 
     myOpenMapView.getOverlays().add(myScaleBarOverlay); 
    } 
} 
+0

下一次請註明您所使用的庫,在這種情況下'osmdroid'。我將它添加到您的標籤。 – scai

+0

和什麼版本的osmdroid。 – spy

+0

@spy:'osmdroid-android',版本:'4.2' –

回答

1

我補充檢查WRITE_EXTERNAL_STORAGE當我同意它的工作好

相關問題