I am programming an app in Java using Android Studio. I already displayed a map using osmdroid, added some overlays to display markers on special locations and added a title & a description to the markers.
Now I display the title & description of the marker on click using the setFocusItemsOnTap method. My problem is that I am not able to hide the title & description of the marker on a second click (so if its already shown). Is there any way to do this?
Or if thats not possible is there a way to only display the title & description of one marker at once using the setFocusItemsOnTab methode?
public static List<OverlayItem> items = new ArrayList<OverlayItem>();
//[...]
items.add(new OverlayItem("uid1","Title", "Description", new GeoPoint(51.398,6.875)));
//[...]
List<OverlayItem> currentList;
currentList = new ArrayList<OverlayItem>();
currentList.add(items.get(i));
//[...]
final ItemizedOverlayWithFocus<OverlayItem> mOverlay = new ItemizedOverlayWithFocus<OverlayItem>(this, currentList, new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
//here it should decide if the title & description is already shown or not. (true => hide it, false => display it)
return true;
}
@Override
public boolean onItemLongPress(final int index, final OverlayItem item) {
return false;
}
});
mOverlay.setFocusItemsOnTap(true);
I have to use these parts of the code, because i wanted to add different markers and i wanted to be able to focus all of them. Also i need to be able to add them to a dynamic list during runtime.
Thanks for your help!
asked
24 Dec '17, 13:20
steve1242
11●1●1●2
accept rate:
0%