Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between OnTouchListener and OnClickListener

I made an app which implements a View.OnTouchListener. But when I uploaded it to Android Market (Google Play Store), I got the following message:

This apk requests 1 features that will be used for Android Market filtering: android.hardware.touchscreen

I really don't need a touchscreen per se. You could also "click" the view and this would be fine. If I use OnClickListener, instead of OnTouchListener, would this requirement go away?

What percentage of Android devices do not have a touch screen? Should this update from OnTouchListener to OnClickListener be something worthwhile in terms of new potential users?

like image 250
Sandy Avatar asked Jul 19 '11 03:07

Sandy


Video Answer


1 Answers

OnTouchListener is for more fine-grained control than OnClickListener. If what you really care about is clicks -- i.e., the combination of of down-touch/up-touch/no-drag -- then use OnClickListener, that's its purpose.

like image 177
cdhabecker Avatar answered Oct 19 '22 13:10

cdhabecker