2

Recently after updating Android Studio to 3.0 and everything was working fine, but from today it shows warning on every setOnTouchListener() of any view also the logic inside it dose not seem to work properly anymore, i don't exactly remember if i have updated any library.

Warning message:

Custom View 'NestedScrollView' has setOnTouchListener called on it but does not override performClick

enter image description here

After searching on Stackoverflow i implemented following solution but it did not remove the warning.

switch (motionEvent.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                        //some code....
                        break;
                    case MotionEvent.ACTION_UP:
                        view.performClick();
                        break;
                    default:
                        break;
                }

Any idea why this is happening?

1 Answers1

2

Too late with an answer, but for others who is running into the same issue. Actually, the solution is given in the warning text: you need to override performClick() method in your class. Just put this code in it:

@Override
public boolean performClick() {
    return super.performClick();
}
Alexey
  • 1,521
  • 1
  • 13
  • 24