0

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's gravatar image

steve1242
11112
accept rate: 0%

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×66
×44
×36
×1

question asked: 24 Dec '17, 13:20

question was seen: 2,198 times

last updated: 24 Dec '17, 13:20

powered by OSQA