Android MenuItem Get Method for showAsAction
android, menuitem
Solution
You can use this method, from what was said in the other answer:
@SuppressLint("RestrictedApi")
private int getShowAsActionFlag(MenuItem item) {
MenuItemImpl itemImpl = ((MenuItemImpl) item);
if (itemImpl.requiresActionButton()) return MenuItemImpl.SHOW_AS_ACTION_ALWAYS;
else if (itemImpl.requestsActionButton()) return MenuItemImpl.SHOW_AS_ACTION_IF_ROOM;
else if (itemImpl.showsTextAsAction()) return MenuItemImpl.SHOW_AS_ACTION_WITH_TEXT;
else return MenuItemImpl.SHOW_AS_ACTION_NEVER;
}
Problem
I am looking for the complimentary method to mentuItem.setShowAsAction(), i.e. menuItem.getShowAsAction() as there doesn't seem to be one. http://developer.android.com/reference/android/view/MenuItem.html As I need to record the current state before setting them to MenuItem.SHOW_AS_ACTION_NEVER, so when the orientation of the device changes back to landscape I can return the menu items to their old state. I need to do this as Honeycomb doesn't provide a new row to show tabs like in ICS. So in honeycomb there is not enough space given to the tabs. Is there another universal get properties method in Java or Android to find the setting in the XML for the attribute showAsAction in menuitem. thanks