Reputation: 476
I want to show a location on a map based on latitude and longitude coordinates. When I press a button I want to send the coordinates to Google Maps (or other app) and pinpoint that location. Any ideas of how I can achieve that?
Upvotes: 1
Views: 15655
Reputation: 476
I've found a simple solution. I start the google maps app via an intent
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?q=" + serviceActivity.Latitude.toString() + "," + serviceActivity.Longitude.toString()));
startActivity(intent);
Upvotes: 1
Reputation: 373
If you want to animate to a specific point on a google map you need to define a MapView. Then create a MapController and animate to a specific GeoPoint:
MapController mapController = mapView.getController();
double lat = latitude * 1e6;
double lon = longitude * 1e6;
GeoPoint startpoint = new GeoPoint((int) lat, (int) lon);
mapController.animateTo(startpoint);
Try this tutorial :MapView Tutorial
Upvotes: 1
Reputation: 5368
Here is the nice example:
http://mobiforge.com/developing/story/using-google-maps-android
http://saigeethamn.blogspot.in/2009/10/google-maps-on-android-android.html
Hope this will helps you..
Upvotes: 2