2011-04-05 56 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

相关问题