开发者

I use following code to display Map & I want to tag current location on map, can anyone help me

public class MapDisplay extends MapActivity 
{
    MapView mapView;
    private MapController mapController;
    GeoPoint currentLocation;
    LocationManager locationManager;
    TextView textView;
    Location location;
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mapView=(Ma开发者_开发知识库pView)findViewById(R.id.mapView);

    //setting map parameters
    mapView.setBuiltInZoomControls(true);
    mapView.displayZoomControls(true);
    mapView.setStreetView(true);
    //mapView.setSatellite(false);
    mapController=mapView.getController();
    mapController.setZoom(18);
}
@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}
}


Look into following http://mobiforge.com/developing/story/using-google-maps-android and search for this keyword on this page Displaying a Particular Location


You need to first obtain your current location and then once you do it's a matter of displaying it on your map.


Here is nice article.http://blog.sptechnolab.com/2011/01/01/android/getting-started-with-android-map-view/


The easiest way is to use a MyLocationOverlay. With it you can even keep the location you display updated, if you want. By subclassing it, you also can change the drawable of the marker.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜