The problem that can occur when using onTouchEvent()
is that because of your view hierarchy, in which you also have other views on top of your activity, it concerns views that override this event (buttons, edittext, etc. .) will not decline; you no longer need activity, and you will not receive them.
Instead, you should use dispatchTouchEvent()
, as it spreads differently, from activity to your other views, and is always called.
@Override public boolean dispatchTouchEvent(MotionEvent ev) {
source share