hi guys,
i'm working with a google maps for a while now. i'm having multiple
markers in the map once you select a perticular maker an Overaly will
appear so once the Overlay is selected i want to get the index of the
overlay. every time its 0.
this is how i'm adding overlays
GeoPoint point = new GeoPoint((int) (postal_lat * 1E6),
(int) (postal_lng * 1E6));
Drawable postal_icon =
getResources().getDrawable(R.drawable.location);
MyItemizedOverlay itemizedOverlay2 = new
MyItemizedOverlay(postal_icon, mapview);
OverlayItem overlayItem_postal = new OverlayItem(point,
postal_msg, null);
itemizedOverlay2.addOverlay(overlayItem_postal);
MyItemizedOverlay implementation
public class MyItemizedOverlay extends
BalloonItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> m_overlays = new
ArrayList<OverlayItem>();
private Context c;
public MyItemizedOverlay(Drawable defaultMarker, MapView mapView) {
super(boundCenter(defaultMarker), mapView);
c = mapView.getContext();
}
public void addOverlay(OverlayItem overlay, int id) {
m_overlays.add(overlay);
populate();
}
@Override
protected OverlayItem createItem(int i) {
return m_overlays.get(i);
}
@Override
public int size() {
return m_overlays.size();
}
@Override
protected boolean onBalloonTap(int index) {
NearestLocation near = MapInfo.nearestArray[index];
Toast.makeText(c, "index " + near.getPartname() + index,
Toast.LENGTH_LONG).show();
return true;
}
}
onBalloonTap always returns 0??
regards,
Mike
--
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