Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Forcing a MapView to redraw

Tags:

android

I've found that after changing the overlays on a MapView, the changes aren't seen until the user moves the Map, causing a redraw. Is there a way to force this redraw?

like image 236
karnage Avatar asked Mar 10 '10 17:03

karnage


1 Answers

In your Overlay, keep a reference to the MapView. Then when you want to force a redraw, call:

mMapView.invalidate();

Alternatively, if you're not in the UI thread, you can call this:

mMapView.postInvalidate();
like image 124
Dan Lew Avatar answered Nov 12 '22 16:11

Dan Lew