2011-04-05 53 views
3

我使用此代碼。我的問題是它沒有顯示maps.google.com中顯示的點。我正在使用Google API for 2.1。我正在關注這個Google map link 檢查差異。你會發現在花園的左上角。爲什麼Google地圖不顯示Android上的特定點?

enter image description here

這裏我的代碼是

package com.my.test; 


public class MapsActivity extends MapActivity { 

MapView mapView; 
MapController mc; 
GeoPoint p; 

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

    mapView = (MapView) findViewById(R.id.mapView); 
    LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom); 
    View zoomView = mapView.getZoomControls(); 

    zoomLayout.addView(zoomView, 
     new LinearLayout.LayoutParams(
      LayoutParams.WRAP_CONTENT, 
      LayoutParams.WRAP_CONTENT)); 
    mapView.displayZoomControls(true); 

    mc = mapView.getController(); 
    String coordinates[] = {"-6.23", "106.83"}; 
    double lat = Double.parseDouble(coordinates[0]); 
    double lng = Double.parseDouble(coordinates[1]); 

    p = new GeoPoint(
     (int) (lat * 1E6), 
     (int) (lng * 1E6)); 

    mc.animateTo(p); 
    mc.setZoom(17); 
    mapView.invalidate(); 
} 

@Override 
protected boolean isRouteDisplayed() { 
    return false; 
} 

}

+0

您需要創建覆蓋類來指向地圖上的某些東西。 – Sandy 2011-04-05 06:01:20

+0

這意味着我必須用圖像創建我的特定點?這是一個場景。 – Arslan 2011-04-05 06:09:39

+0

是啊!你不得不。 – Sandy 2011-04-05 06:58:46

回答

2

您可以獲得示例here

它是一個非常好的鏈接。

+0

是的,我正在關注相同的鏈接。謝謝你的時間。 – Arslan 2011-04-05 09:45:52

+0

非常好的文章指出你。我希望我可以給你兩次投票。 – 2011-06-16 08:59:49

+0

@Deependra謝謝 – Sandy 2011-06-16 14:41:18

0

我認爲你需要放大多一點。之後你會看到所有的要點。

+0

我試過縮放但結果相同。該位置不顯示。我想我必須從我的代碼中指出它。 – Arslan 2011-04-05 06:12:13

相關問題