How to create a DoubleTapListner in Android

button.setOnClickListener(this);

You must have seen this a thousand times. I bet. Wouldn’t it be nice to have something like this for “DoubleTapListner”

You can create a DoubleTapListener by yourself by extending View.OncliclkListener and attach it to any View(Button, TextView, EditText, etc) in Android.

Follow these simple steps and you will be able to create a Double, Triple and even a “unicorn” listener.

Step1:

Create an interface

Step 2:

Create a class DoubleTapListner which extends View.OnClickListener

Step 3:

Use it in your Activity

And you are done!

You can see the full code HERE

Putting up content takes a lot of time and effort 😓.
👏 clap 👏 If you think you learned something from this article.
You can find me on Stackoverflow,Github,and,on Linkedin.
Give feedback and feel free to correct mistakes.

--

--

--

Android Developer | Arizona State University | NASA Psyche Research Aide

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rohit Singh

Rohit Singh

Android Developer | Arizona State University | NASA Psyche Research Aide

More from Medium

Publish an android library opensource with Jitpack

TIC TAC TOE GAME APP

Expert: Integration of HMS Core Kits in Expense Android App

How to Deal with Quantity Texts in Multi-Language App in Android