android maps: How to Long Click a Map?
- by vamsibm
Hi.
How do I long click on a mapview so that a place marker appears at that point on the map?
I tried a couple ways without success:
1) Using setOnLongClickListener on the MapvView which never detected the longclicks.
2) My other idea was to extend MapView to override dispatchTouchEvent .. Create a GestureDetector to respond to longpress callback. But I was stuck midway here as I could not get a handle to my subclassed Mapview. i.e.
MyMapview mymapview; //MyMapView extends MapView
mymapView = (MyMapView) findViewById(R.id.map); //results in a classcast exception
3) The only other way I know how to try this is:
Detect a MotionEvent.ACTION_DOWN and post a delayed runnable to a handler and detect longpress if the two other events: acton_move or an action_up, have not happened.
Can someone provide thoughts on any of these methods to detect long presses?
Thanks in advance.
Bd