I need to call interface while double tap on google mapFragment.
I am able to detect double tap on map now.
This is my TouchableWrapper class
public class TouchableWrapper extends FrameLayout {
GestureDetectorCompat mGestureDetector;
public TouchableWrapper(Context context) {
super(context);
mGestureDetector = new GestureDetectorCompat(context, mGestureListener);
}
private final GestureDetector.SimpleOnGestureListener mGestureListener
= new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDoubleTap(MotionEvent e) {
Log.e("GestureDetector", "Executed");
//here i need to call my interface method
return true;
}
};
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
mGestureDetector.onTouchEvent(ev);
return super.onInterceptTouchEvent(ev);
}
}
This is my interface
public interface OnMapInterCept {
void OnInterCeptMap(String isMapTap);
}
Below MapFragment i am using
public class CustomMapFragment extends MapFragment {
public View mOriginalContentView;
public TouchableWrapper mTouchView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
mOriginalContentView = super.onCreateView(inflater, parent, savedInstanceState);
mTouchView = new TouchableWrapper(getActivity());
mTouchView.addView(mOriginalContentView);
return mTouchView;
}
@Override
public View getView() {
return mOriginalContentView;
}
}
How i will call this interface, i need to zoom map on center while double tap on MapFragment inside fragment.
Please i need help.Thank you
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…