Search code examples
androidsuppress-warnings

How can suppress Warning "Method can be void"?


Hi I am analyzing the code with the android studio tool, and a few methods have got the following warning "Method can be null", and I want to suppress this, but I don't find the quote to SupressWarnings.

Thanks.


Solution

  • Press "Alt+Enter" on the method, on one of the suggestions (light bulbs), press right key, then select "Disable Inspection".

    This should disable all null checks. Use carefully, though. If that's not what you require, select other options, all of them are listed there.