TharakaNirmana
TharakaNirmana

Reputation: 10353

Load Map with bubbles on page load in android

In my application there is a map and the map has many pins. When the user taps on a pin, name of the touched pin appears in a balloon. What I want is to display all balloons on page loads, not when the user touches a pin. I have written the ItemizedOverlayWithBubble class and it overrides a method called onSingleTapUpHelper:

@Override protected boolean onSingleTapUpHelper(final int index, final Item item, final MapView mapView) {
        showBubbleOnItem(index, mapView, true);
        return true;
    }

Inside that there is another method call showBubbleOnItem(index, mapView, true);

public void showBubbleOnItem(final int index, final MapView mapView, boolean panIntoView) {
        ExtendedOverlayItem eItem = (ExtendedOverlayItem)(getItem(index)); 
        mItemWithBubble = eItem;
        if (eItem != null){
            eItem.showBubble(mBubble, mapView, panIntoView);
            //setFocus((Item)eItem);
        }
    }

I played around with it for a while to see if I could get it working on page load but got no luck. Any help is greatly appreciated.

Upvotes: 0

Views: 105

Answers (1)

Ismail Sahin
Ismail Sahin

Reputation: 2710

Possibly your points are overlaps with each other. Especially if you create GeoPoints from integers with small difference like 11,1 and 12,2 and 13,3 this will couse overlaped overlay items

Have a look at here package org.osmdroid.util.GeoPoint when you use

GeoPoint(final int aLatitudeE6, final int aLongitudeE6)

Your value will not be multiplyed with 1E6(which is 1.000.000) So there is no place difference between this two points on MapView

GeoPoints(11,1) and GeoPoints(12,2)

Upvotes: 1

Related Questions