How to create a DoubleTapListner in Android

Rohit Singh
1 min readFeb 4, 2020

--

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.

--

--

Rohit Singh
Rohit Singh

Written by Rohit Singh

Android Developer | Arizona State University | NASA Psyche Research Aide

No responses yet