I currently have implemented an overlay item that shows an icon for Geo-point on a map application in Android. When the icon is clicked, it brings up an AlertDialog
from the onTap
method below. I have the following questions:
If so, please share some sample code. Thanks
protected boolean onTap(int index) {
OverlayItem item = mOverlays.get(index);
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle(item.getTitle());
dialog.setMessage(item.getSnippet());
dialog.show();
return true;
}
As for #1, you can see how to create popup panels in this sample project from one of my books.
As for #2, I do not believe it is possible, strictly speaking. Certainly, there is nothing built in for that, at least that I have seen. You could attempt to detect a touch event, get rid of the existing overlay item, draw your own copy of the icon where the overlay item had been, manually animate that as the user drags, and then put the overlay item where the user drops it (getting rid of your manually-drawn icon).