Search code examples
androidosmdroid

Osmdrord / osmbonuspack - customize navigation arrow (via MyLocationNewOverlay?)


How can I change the color of the current navigation/position arrow?

Now when there is no GPX info, a little man is shown. When movigng the current position / navigation arrow is green. I would like to be able to set another color.

Thanks: I am using osmdroid / osmbonuspack with gratitude for years!


Solution

  • Far as I know you can not change the color of the arrow since it is just a default icon. But you can use the built-in object of osmdroid maps to show your location with your own arrow/person icons.

    MyLocationNewOverlay myLocationNewOverlay = new MyLocationNewOverlay(mMap);
    myLocationNewOverlay.enableFollowLocation();
    myLocationNewOverlay.enableMyLocation();
    

    replace the icons

    myLocationNewOverlay.setDirectionArrow(yourPersonBitmap, yourArrowBitmap);
    

    then just add this overlay to your map

    mMap.getOverlayManager().add(myLocationNewOverlay);