On Sat, Feb 13, 2010 at 8:31 AM, Fabian Sturm <[email protected]> wrote:

> I want to add an ItemizedOverlay to a MapView that always keeps one
> OverlayItem as the selected one.
>
Are you sure you want to do this? This goes against the standard behavior of
"deselecting" when clicking somewhere on the map (possible to remove a popup
or other obstructing view). But if you really want to...

But right now, whenever I tap on the map and not hitting a marker, the
> last selected item will get deselected. But I always want to keep the
> last item selected until a new one is hit.
>


> I already tried to intercept e.g. onTap, but this only lets me
> completely disable the tap handling.
>
> Any suggestions what to do about this?
>

Keep track of the last selected item. In onTap() if the currentFocus() is
null, setFocus() to the last selected item you saved. If it's not null,
update your reference.

You can also use the same idea but using the OnFocusChangeListener on the
ItemizedOverlay to determine if a new item has been focuses or not.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to