Before asking a question, let me give additional information:
I have a snippet that adds MenuItemin onCreateOptionsMenu. Added MenuItem also has a custom ActionProviderone added to it.
Custom ActionProviderdoes not use an ActionView, but instead cooks SubMenuwith certain items to choose from. For this reason, I installed ActionProvideras follows:
- I return
nullin the methodonCreateActionView hasSubMenu() returns true- At
onPrepareSubMenu(SubMenu Menu)first, I clear the current menu, then add the necessary elements - I process correctly
onMenuItemClickin ActionProvider - Since I use ActionBarSherlock, my ActionProvider extends
com.actionbarsherlock.view.ActionProvider, not android.support.v4.view.ActionProvider(I don’t know if it should have any value, but at the moment I don’t know what it does)
Everything is going well on devices with Android versions above 3.0. I see added MenuItem, it has the correct one SubMenu(from the border ActionProvider) and the correct actions are performed for each menu option. But with devices running Android versions below 3.0 (I could only test this on device 2.3.6), something is strange; hence the next question.
Google clearly states:
"onPerformDefaultAction ()
, , . , , onPrepareSubMenu(), , . , onPerformDefaultAction() , ."
: http://developer.android.com/guide/topics/ui/actionbar.html#CreatingActionProvider
, , onPerformDefaultAction() ActionProvider. Android 2.3.6 onPerformDefaultAction() DOES, SubMenu.
: onPrepareSubMenu(SubMenu Menu) onPerformDefaultAction()? Android 2.3.6.
EDIT:
, SubMenus.java ActionbarSherlock. SubMenu ActionProvider onCreateOptionsMenu(Menu menu) OnMenuItemClickListener MenuItem.
. , , ActionProviders .