2

In Google Maps v2 for Android, there is a Marker object. It has an icon field that allows you to set a drawable for this marker. However, I would like to get the icon that was previously set on a marker. Is there a way to do this? I have dozens of markers on the map, and I want to calculate the boundaries of the drawables of each of those markers, in order to avoid collisions.

Thank you, Igor

IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147
  • For you, I left the more full comment at [here in Stack Overflow](http://stackoverflow.com/a/14451352/1983061). – BBonDoo Jan 22 '13 at 03:59

2 Answers2

0

This below is the sample code in the demo files of Google Maps APIS v2. This shows us the HOW TO USE the custom icon in Google Maps.

    private void addMarkersToMap() {
        // Uses a colored icon. this is default icon.
        mBrisbane = mMap.addMarker(new MarkerOptions()
                .position(BRISBANE)
                .title("Brisbane")
                .snippet("Population: 2,074,200")
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));

        // **Uses a custom icon.**
        mSydney = mMap.addMarker(new MarkerOptions()
                .position(SYDNEY)
                .title("Sydney")
                .snippet("Population: 4,627,300")
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.arrow)));

R.drawable.arrow will be your custom icon : Make your icon using the Graphic software(such as Photoshop)and then insert your icon into the folder of res/drwable in your project.

BBonDoo
  • 766
  • 5
  • 14
0

This is help for me

 markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
Dhaval Shingala
  • 127
  • 1
  • 5