Android: Disable text selection in a webview

This worked for me

mWebView.setOnLongClickListener(new OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
        return true;
    }
});
mWebView.setLongClickable(false);

I have not tested, if you don't want the vibration caused by the long click, you can try this:

mWebView.setHapticFeedbackEnabled(false);

It appears that cut/paste via long press is turned off if you used

    articleView.setWebChromeClient(new WebChromeClient(){...})

See https://bugzilla.wikimedia.org/show_bug.cgi?id=31484

So if you are using setChromeClient and you WANT to have long click to start copy/paste, the do the following:

    webView.setWebChromeClient(new WebChromeClient(){

        [.... other overrides....]

        // @Override
        // https://bugzilla.wikimedia.org/show_bug.cgi?id=31484
        // If you DO NOT want to start selection by long click,
        // the remove this function
        // (All this is undocumented stuff...)
        public void onSelectionStart(WebView view) {
            // By default we cancel the selection again, thus disabling
            // text selection unless the chrome client supports it.
            // view.notifySelectDialogDismissed();
        }

    });

Setting webkit css property -webkit-user-select to none would solve the problem.

Example CSS to disable selection:

* {
   -webkit-user-select: none;
}

I figured it out!! This is how you can implement your own longtouchlistener. In the function longTouch you can make a call to your javascript interface.

var touching = null;
$('selector').each(function() {
    this.addEventListener("touchstart", function(e) {
        e.preventDefault();
        touching = window.setTimeout(longTouch, 500, true);
    }, false);
    this.addEventListener("touchend", function(e) {
        e.preventDefault();
        window.clearTimeout(touching);
    }, false);
});

function longTouch(e) {
    // do something!
}

This works.