Warning: Cannot modify header information - headers already sent by (output started at /var/www/lalieno.it/index.php:48) in /var/www/lalieno.it/inc/cookie.php on line 3
a cadenza discontinua
Come se fossi
BLOG

[Android Studio / Java ] - Add markers to map

 

The customization of the markers from version 2 of goggle maps of Android is extremely simple , I'll illustrate a simple example of a marker with image , title and custom description .

 

mMap.addMarker(new MarkerOptions()
	.position(new LatLng(41.0692385,14.3333778))
	.title("Geek-Blog.it")
	.snippet("Altro testo")
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon)));

This banal example we indicated the location , title, detail and icon . Obviously the marker will be placed after the map is initialized. you can also clean up the map with the clear method ( nMap.clear ( ) ; ) , or more specifically go to delete a single marker :

Marker marker = map.addMarker(..);

Invoking the remove method of marker:

marker.remove();


di GuiZ
28/10/2015

Commenta

We'll never share your email with anyone else.