Why does Android Studio suggest that onTouch call view.performClick?

Issue

I’m getting the following suggestion on my ouTouch() function:

enter image description here

why is this?

Solution

if you are overriding onTouch listener and you are not calling performClick when clicks are detected, the View may not
handle accessibility actions properly. Logic handling the click actions should
ideally be placed in View#performClick as some accessibility services invoke
performClick when a click action should occur.
so to get rid of the warning you have to call v.performClick();

MotionEvent.ACTION_UP:
        v.performClick();
        break;

or

@SuppressLint("ClickableViewAccessibility")

Answered By – tamtom

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published