Skip to content

Instantly share code, notes, and snippets.

@ursimon
Created February 10, 2014 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ursimon/8913085 to your computer and use it in GitHub Desktop.
Save ursimon/8913085 to your computer and use it in GitHub Desktop.
Launch google map w/ marker
/**
* starts google maps w/ lat lon
*/
public static void showOnMap(Context c, double lat, double lng, String name) {
String geoUri = "geo:"+lat+","+lng+"?q="+lat+","+lng+"("+name+")";
Uri geo = Uri.parse(geoUri);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(geo);
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
if (intent.resolveActivity(c.getPackageManager()) != null) {
c.startActivity(intent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment