Is there anyway to remove an onTouchListener from a view object?

So in you activity you would set your overridden onTouchListener:

            mWebView.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                v.setOnTouchListener(mWebView.mOnTouchListener);
                return false;
            }
        });

And you would have to make a new class, extending WebView. And within it you would define an OnTouchListener.

    public final OnTouchListener mOnTouchListener = new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent rawEvent) {
        return false;
    }
}; 

Setting the ontouchlistener to null doesn't reset it to the default definition. You still have to provide an actual listener.


I was looking for help online and got to this post. When I did

myView.setOnTouchListener(null);

my myView stopped responding to the onTouch.


webView.setOnTouchListener(null);