1

I want to catch any onTouchEvent() on the mapview.

After search lots of questions&answers, I found only when I write my own MapView(MyMapView)and define onTouchEvent, then use this MyMapView in main activity.

Is it the only way??

Don Chakkappan
  • 7,397
  • 5
  • 44
  • 59
Robert
  • 1,660
  • 22
  • 39

2 Answers2

1

It's actually the simplest way. When you extend the MapView there are only a few methods that you need to implement and they are really straight forward.

CaseyB
  • 24,780
  • 14
  • 77
  • 112
1

You can also use overlays. See this my answer to the question here: How to capture location from MapActivity

Not sure if all touch events will be routed to the overlay's onTouchEvent though.

Community
  • 1
  • 1
Roman Nurik
  • 29,665
  • 7
  • 84
  • 82