0

We're using OpenStreetMaps with Osmdroid. We need to make the user's marker 'pulse' a small force field ( like Uber's app ).

The Marker class doesn't provide access to the View that's plotted as the marker, so, I'm not able start an animation with 'startAnimation'.

Does anybody know how to do such thing?

Here goes a snippet of my code:

        mUserMarker = new Marker(mOpenStreetMap);
        mUserMarker.setPosition(mCurrentPosition);
        mUserMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_CENTER);
        mUserMarker.setIcon(ContextCompat.getDrawable(getActivity(), R.drawable.ic_my_position));
        mUserMarker.setDraggable(true);
        mUserMarker.setInfoWindow(null);
        mOpenStreetMap.getOverlays().add(mUserMarker);
        mOpenStreetMap.invalidate();
Natan Lotério
  • 689
  • 1
  • 10
  • 20
  • 1
    Did you already take a look at https://stackoverflow.com/q/31337149/1340631 and https://github.com/osmdroid/osmdroid/issues/139? – scai Jun 26 '17 at 16:20
  • 1
    "The Marker class doesn't provide access to the View that's plotted as the marker, so, I'm not able start an animation with 'startAnimation'." The reason is that the Marker is not using android View subclass. Osmdroid builds its own hiearchy of objects called Overlays and then draws them from MapView. Each overlay draws itself in its draw method ( for example see Marker sourcecode https://github.com/osmdroid/osmdroid/blob/5c28a235f6d46241e225f7ce939090ef63ac403f/osmdroid-android/src/main/java/org/osmdroid/views/overlay/Marker.java ). So standard animation support in android will not work. – Josef Adamcik Jul 05 '17 at 12:04

0 Answers0