Get user location on map?
I have a map view that zooms and places markers. I to get the users location on start up. How would I go about do开发者_如何转开发ing this? Thanks in advance.
By on startup - I assume its application start up. Just register a LocationListener before you have your map view displayed. The callback to the LocationListener should give you the current co-ordinates. You can now use these co-ordinates to place markers.
GeoPoint geoPoint = new GeoPoint((int) (your_location_variable.getLatitude() * 1E6),(int) (your_location_variable.getLongitude() * 1E6));
mapController.animateTo(geoPoint);
精彩评论