how to make a continuous press and a double tap on same view in android?

  Kiến thức lập trình

I want to make a continuous press on a View (webView) and also a double tap on the same View.

I tried the gesture detector it works well for just the double tap, but I want a function for the continuous press.

here’s my sample code

            private inner class MyGestureListener : GestureDetector.SimpleOnGestureListener() {

                override fun onDoubleTap(e: MotionEvent): Boolean {
                    webView.evaluateJavascript("showPrevWord();", null)
                    return true
                }

                override fun onLongPress(e: MotionEvent) {
                    webView.evaluateJavascript("showNextWord();", null)
                }
            }

New contributor

MdRaafat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT