png
png

Reputation: 4408

Android: Launching google map with intent how to mark a specific location

I am launching googlemap using an intent giving the latitude and longitude. It shows the map with the area around specified location.

How can i get a marker displayed at this specific location while launching the map.

here is my code for starting the activity :

Intent i = new Intent(android.content.Intent.ACTION_VIEW,
                        Uri.parse("geo:" + lat+ "," + long+ "?z=10"  ) )
startActivity(intent);

Upvotes: 0

Views: 2079

Answers (2)

bee
bee

Reputation: 106

to place mark just use the following example:

// change name - to any text you want to display
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:55.74274,37.56577?q=55.74274,37.56577 (name)"));
// the following line should be used if you want use only Google maps
intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"));
startActivity(intent);

Upvotes: 3

Samir Mangroliya
Samir Mangroliya

Reputation: 40406

you have to use static map api for...check this ..there are link to show mapview if acant work with intent ,You should add webview and loadurl its worked fine...

http://code.google.com/apis/maps/documentation/staticmaps/#Markers

Upvotes: 1

Related Questions