MapView Annotation is flashing when the device position has changed

You must Login before you can answer or comment on any questions.

Hi,

I'm adding some annotations into a MapView object (6 annotations). They are changing their position every 6 seconds. At this moment I'm removing and adding each annotation on every change. Is there any way to move an annotation instead of removing and adding it again?

This is causing some kind of flash with the map object.

Regards, Ariel

— asked 2 years ago by Ariel Sztern
1 Comment
  • Hi Ariel,

    Would you mind posting the code for your function? I'm trying to find out how to write code that would move the annotation around every few seconds too. Thanks!

    — commented 2 years ago by Hanna Zhu

3 Answers

I'm thinking that moving (removing/adding) 6 map annotation every 6 seconds is causing the redraw of those tiles. If there is a finite number of positions that those annotations are going to appear, then it may be better to load all your annotations, then hide and show them as necessary.

In this case, we don't know how many points do we have, because it's representing a car in movement. We found how to move each annotation, but the problem we have is that the new position is not being updated on the map, until a zoom action is made.

Do you know how to refresh the map without flashing? Thanks, Ariel

I'm moving the annotations thru the latitude and longitude parameters

— answered 2 years ago by Ariel Sztern
answer permalink
1 Comment
  • That's how I was trying to do it too - but apparently, it is not working for me :-( How did you do it??

    My code was as simple as tt.ui.carAnnotation = Ti.Map.createAnnotation({ latitude : cloc.coords.latitude, longitude : cloc.coords.longitude, title : 'car', image : tt.ui.CAR_IMAGE }); and then tt.ui.carAnnotation.setLatitude(currLoc.coords.latitude); tt.ui.carAnnotation.setLongitude(currLoc.coords.longitude);

    — commented 11 months ago by Ronnie Guha

Your Answer

Think you can help? Login to answer this question!