I've found that the most robust way to do this is by invalidating the whole menu. So, when you get your async result (in onQueryInventoryFinished
) just call:
invalidateOptionsMenu();
or, if you are using a FragmentActivity
(SherlockFragmentActivity
or ActionBarActivity
)
supportInvalidateOptionsMenu();
In this way the menu will be recreated and you can safely add or remove items as you need.