Skip to content Skip to sidebar Skip to footer

Custom View 'imagebutton' Has Setontouchlistener Called On It But Does Not Override Performclick

Well, I know there are some questions regarding this warning, but i still cannot figure out how to get rid of this. I don't want to implement the OnTouchListener interface on class

Solution 1:

Your code is OK, if you are sure that your code works like you want, you can just disable this kind of warnings in: File -> Settings -> Editor -> Inspections -> Android -> Lint -> Accessibility -> Accessibility in Custom Views

Solution 2:

Basically it suggests that you should subclass ImageButton and override its performClick() method but it's not worth the hassle just suppress this warning using @SuppressLint("ClickableViewAccessibility") in your method or just disable this warning like I did.

Solution 3:

Change your this line of code

View.performClick ();

TO

send.performClick ();

And add this override method at the end of you activity.

@OverridepublicbooleanperformClick() {
// do what you wantreturntrue;
}

Hope that helps

Post a Comment for "Custom View 'imagebutton' Has Setontouchlistener Called On It But Does Not Override Performclick"