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

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

Closed

Description

@mpuchala

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?

Activity

  1. added
    Android
    on Feb 4, 2016
  2. added this to the android-v4.0.0 milestone on Feb 4, 2016
  3. 1ec5 commented on Feb 4, 2016

    @1ec5
    Contributor

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

  4. added
    GL JS parity
    on Feb 4, 2016
  5. socketbind commented on Feb 10, 2016

    @socketbind
    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.

  6. added a commit that references this issue on Feb 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

AndroidGL JS parity

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions