Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Change marker icon without remove/add workaround #3775

Closed
mpuchala opened this issue Feb 1, 2016 · 2 comments
Closed

[android] Change marker icon without remove/add workaround #3775

mpuchala opened this issue Feb 1, 2016 · 2 comments
Assignees
Labels
Android Mapbox Maps SDK for Android GL JS parity For feature parity with Mapbox GL JS

Comments

@mpuchala
Copy link

mpuchala commented Feb 1, 2016

Hi Guys,

I'm using your map with more or less 500 - 1k markers at a time. There are few types of icons. Some of them are just made from resources and cached, but I'm using clustering as well. That’s why many of them have to be created as a new Bitmap.

My issue is about changing marker icon during the runtime. On Github I saw this thread: #3146. Does it mean it would be possible to change icon on Android in different way than removing/changing/adding new marker? In fact this solution is problematic - it can take up to 1000ms and looks awful (tested on Nexus 4, Android 5.1). It blocks UI thread so despite the fact clustering is slow and setting different icons according to zoom doesn’t work smooth it affects another views (ex. animations). Actually even this code can take up to 200ms:

mMapView.removeAnnotation(mMarkerOptions.getMarker());
mMarkerOptions.icon(...);
mMapView.addMarker(mMarkerOptions);

Maybe you have any idea how can I improve it?

@bleege bleege added the Android Mapbox Maps SDK for Android label Feb 4, 2016
@bleege bleege added this to the android-v4.0.0 milestone Feb 4, 2016
@1ec5
Copy link
Contributor

1ec5 commented Feb 4, 2016

The iOS SDK supports changing marker images without adding and removing markers (#3146, #3320). -[MGLMapView annotationImageNeedsRedisplay:] should be ported to the Android SDK.

@socketbind
Copy link
Contributor

Hi,

I have been actually working on this (+ the ability to set the position also) but my code is a bit crude (see referenced pull request). I would love to improve upon it and make this happen.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android GL JS parity For feature parity with Mapbox GL JS
Projects
None yet
Development

No branches or pull requests

7 participants