Reputation: 2993
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?
Upvotes: 12
Views: 2947
Reputation: 2576
If you're using support library and AppCompatActivity, you should call supportInvalidateOptionsMenu.
Upvotes: 4