Thursday, March 01, 2012

Watch out for using the same drawable reference on an maps overlay and on a dialog

I've been having problems where I display multiple items on an overlay.
When displaying an alert dialog on top, some of the items got corrupted, and remained so even when closing the alert dialog.

When you create an overlay item, you define the drawable draw bounds by issuing boundCenter(drawable) or boundCenterBottom(drawable).

The problem was that I used the same drawable as an icon on the alert dialog displayed on top. The dialog somehow altered the draw bounds under rendering which caused the overlay item to be corrupt.

The fix is to use separate drawable instances for the overlay and alert dialog

Labels: