2013-03-22 102 views
1

我使用nutiteq地圖,我已經提出,做工精細的例子簡單的hello地圖,但 當我申請cloude做的地圖,則地圖沒有顯示我的代碼如下: -地圖不顯示?

public class EastWoodLogin extends Activity { 
private BasicMapComponent mapComponent; 
private String userid=""; 

/** Called when the activity is first created. */ 
@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.eastwoodlogin); 
    Log.enableAll(); 
    Log.setLogger(new AndroidLogger("myapp")); 

    mapComponent = new BasicMapComponent("tutorial", new AppContext(this), 
      1, 1, new WgsPoint(28.635308000000000000,77.224960000000010000), 10); 
    //mapComponent.setMap(OpenStreetMap.MAPNIK);//when use this work fine 

// userId for CloudMade token auth 
    TelephonyManager telephonyMgr = (TelephonyManager) 
    this.getSystemService(Context.TELEPHONY_SERVICE); 
    this.userid = telephonyMgr.getSubscriberId(); 

    mapComponent.setMap(new CloudMade("0edfc04001d84f2d98fef6e9744241cf", userid, 256, 1));// when use this map is not showing 
    mapComponent.setPanningStrategy(new ThreadDrivenPanning()); 
    mapComponent.startMapping(); 

    // get the mapview that was defined in main.xml 
    MapView mapView = (MapView) findViewById(R.id.mapview); 

    // mapview requires a mapcomponent 
    mapView.setMapComponent(mapComponent); 

    ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols); 
    // set zoomcontrols listeners to enable zooming 
    zoomControls.setOnZoomInClickListener(new View.OnClickListener() { 
     public void onClick(final View v) { 
      mapComponent.zoomIn(); 
     } 
    }); 
    zoomControls.setOnZoomOutClickListener(new View.OnClickListener() { 
     public void onClick(final View v) { 
      mapComponent.zoomOut(); 
     } 
    }); 

// GPS Location 
    final LocationSource locationSource = new AndroidGPSProvider(
    (LocationManager) getSystemService(Context.LOCATION_SERVICE), 1000L); 
    Bitmap icon = BitmapFactory.decodeResource(getResources(), 
      R.drawable.icon); 
    final LocationMarker marker = new NutiteqLocationMarker(new PlaceIcon(Image 
         .createImage(icon), icon.getWidth()/2, icon.getHeight()/2), 3000, true); 
    locationSource.setLocationMarker(marker); 
    mapComponent.setLocationSource(locationSource); 


    mapComponent.addKmlService(new KmlUrlReader(
      "http://www.panoramio.com/panoramio.kml?LANG=en_US.utf8&", true)); 
} 

}

請任何人指導我在哪裏我錯了,在此先感謝。

+1

延伸MapActivity! – 2013-03-22 07:19:38

+0

我懷疑你的令牌認證是錯誤的。請爲此創建另一個令牌ID,然後重試。 – AndroidEnthusiastic 2013-03-22 07:23:02

+0

檢查您的Manifest文件中是否添加了Internet權限。 <使用的許可機器人:名稱=「android.permission.INTERNET對」 /> – Asteriskiiii 2013-03-22 07:27:53

回答

1

有一個在你使用的版本中的錯誤 - 它試圖讓HTTP POST請求,但CloudMade不接受他們。大多數其他來源沒有這個問題。從http://www.nutiteq.com/beta/lib/android_maps_lib-1.1.2a.jar下載固定版本,它修復它嗎?

+0

嗨我添加這個罐子,代替白色屏幕藍色屏幕顯示,尚未加載地圖。 – SKT 2013-03-23 10:30:59