开发者

Why doesn't Google map show specific point on Android?

开发者 https://www.devze.com 2023-02-22 16:03 出处:网络
I am using this code. My problem is that it is not showing the point which is displayed in maps.google.com. I am using Google API for 2.1. I am following this Google map link

I am using this code. My problem is that it is not showing the point which is displayed in maps.google.com. I am using Google API for 2.1. I am following this Google map link Check out the difference. You will notice in top left corner of garden.

Why doesn't Google map show specific point on Android?

Here my code is

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;
}

}


You can get the example here.

Its a very good link.


I think you need to zoom a bit more. After that you will see all the points.

0

精彩评论

暂无评论...
验证码 换一张
取 消