How Do I Disable setOnClickListener on Android?
Contents

What is setOnClickListener in Android?

One of the most usable methods in android is setOnClickListener method which helps us to link a listener with certain attributes. setOnClickListener is a method in Android basically used with buttons, image buttons etc. You can initiate this method easily like, public void setOnClickListener(View.OnClickListner)

How do you turn off click on Android?

I would create a ViewGroup with all the views that you want to enable/disable at the same time and call setClickable(true/false) to enable/disable clicking. You can pass View for disable all child click event.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest