GoogleMap by default doesn’t provide event for map drag start and drag stop. I have already reported that problem here.
I want to make custom handler that will use plain onTouch event and combine it with setOnCameraChangeListener.
However i failed to find how I can access onTouch event of GoogleMap object. It doesn’t provide such callback.
I wonder how can i handle onTouch event for map in Google Map API v2?
Here is a possible workaround for determining drag start and drag end events:
You have to extend
SupportMapFragmentorMapFragment. InonCreateView()you have to wrap yourMapViewin a customizedFrameLayout(in example below it is the classTouchableWrapper), in which you intercepts touch events and recognizes whether the map is tapped or not. If youronCameraChangegets called, just check whether the map view is pressed or not (in example below this is the variablemMapIsTouched).Example code:
UPDATE 1:
getView()dispatchTouchEvent()instead ofonInterceptTouchEvent()Customized FrameLayout:
In your customized MapFragment:
In your camera change callback method: