Как долго нажимать на карту, чтобы маркер места отображался в этой точке на карте?
Я пробовал пару способов без успеха:
1) Используя setOnLongClickListener
на MapvView
, который никогда не обнаруживал длинные клавиши.
2) Моя другая идея заключалась в расширении MapView
для переопределения dispatchTouchEvent
. Создайте GestureDetector, чтобы ответить на обратный вызов longpress. Но я был застрял на полпути, так как не мог получить доступ к моему подклассу Mapview. то есть.
MyMapview mymapview; //MyMapView extends MapView
//results in a classcast exception
mymapView = (MyMapView) findViewById(R.id.map);
3) Единственный способ узнать, как это сделать:
Обнаружить MotionEvent.ACTION_DOWN
и опубликовать задержанную runnable для обработчика и обнаружить longpress, если не произошло двух других событий: acton_move или action_up.
Может ли кто-нибудь дать мысли о любом из этих методов для обнаружения длинных нажатий?