Reputation: 2442
I want to display a dialog box when tapping a marker on my map. i could set the marker on the map, but i am unable to pop up the dialog box which should contain the some description about the marked place. I tried overriding onTouchEvent(), but then the box appeared only when tapping the exact point. But what i want is to display the dialog box when touching any point within the marker. Could anybody pls help me?
Thanks.
Upvotes: 2
Views: 6681
Reputation: 1830
In this case, i have class extend ItemizedOverlay you just override onTap
public class PlaceItemizedOverlay extends ItemizedOverlay<OverlayItem> {
@Override
protected boolean onTap(final int index) {
final OverlayItem oi = mOverlays.get(index);
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle("your title");
dialog.setMessage("youmessage");
dialog.setNegativeButton("Cancel", null);
dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
});
dialog.show();
return true;
}
}
Upvotes: 2