Why not ask your question on the new OpenStreetMap Community Forum?

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>();
final ItemizedOverlayWithFocus<OverlayItem> mOverlay = new ItemizedOverlayWithFocus<OverlayItem>(this, currentList, new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
            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;
            public boolean onItemLongPress(final int index, final OverlayItem item) {
                return false;

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

accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

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:


question asked: 24 Dec '17, 13:20

question was seen: 4,176 times

last updated: 24 Dec '17, 13:20

powered by OSQA