NRahman NRahman - 1 year ago 162
Android Question

Set Image from drawable as marker in Google Map version 2

I am using this part of code to add a marker in a

in Google Map Version 2.

MarkerOptions op = new MarkerOptions();
m = map.addMarker(op);

I want to use different images from my drawable. Any help will be appreciated.

Answer Source

This is how you can set any Drawable as a Marker

BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.current_position_tennis_ball)

MarkerOptions markerOptions = new MarkerOptions().position(latLng)
         .title("Current Location")
         .snippet("Thinking of finding some thing...")

mMarker = googleMap.addMarker(markerOptions);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download