Created
February 10, 2014 09:44
-
-
Save ursimon/8913085 to your computer and use it in GitHub Desktop.
Launch google map w/ marker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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