Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

invalidateOptionsMenu() deprecated

In one of my fragment class, I using invalidateOptionsMenu() as below

invalidateOptionsMenu(activity)

but it is deprecated

'invalidateOptionsMenu(Activity!): Boolean' is deprecated. Deprecated in Java

What can be used to replace invalidateOptionsMenu(Activity activity) ?

P/S:This method still can be used, but will it be an issue in future?

like image 328
John Joe Avatar asked Jun 26 '19 09:06

John Joe


1 Answers

They're deprecating this method in favor of calling invalidateOptionsMenu directly on the Activity (which this method actually does, internally). In order to replace it, you can do something like requireActivity().invalidateOptionsMenu().

like image 176
Ricardo Costeira Avatar answered Nov 02 '22 06:11

Ricardo Costeira