I'm using invalidateOptionsMenu()
method to handle changing toolbar MenuItems
but recently lint is highlight this method as an ERROR
and says:
This API is marked as internal to the support library and should not be accessed from apps
Also for navigationview.setNavigationItemSelectedListener(XXX);
method and some others! It's very illogical to use @SuppressWarnings("RestrictedApi")
for solving this problem, because you are just ignoring the lint
but not solving the problem.
how can I fix this issue?
If you're using support library and AppCompatActivity, you should call supportInvalidateOptionsMenu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With