Answer the question
In order to leave comments, you need to log in
Access item in 3-level menu?
Hello, tell me please, how can I reach the items that are in the very depth of the hierarchy? sortingNewActiveMenu и sortingOlderActiveMenu
I built the menu as I need, and now I need to set setChecked () programmatically.
doesn't find anything
MenuItem menuItem = topMenuActionBar.findItem(R.id.sortingNewActiveMenu);
@Override
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
getSupportMenuInflater().inflate(R.menu.app_active_menu, menu);
topMenuActionBar=menu;
return super.onCreateOptionsMenu(menu);
}
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/addNewPeriodMenu"
android:icon="@drawable/plus"
android:showAsAction="always"/>
<item
android:id="@+id/settingsMenu"
android:icon="@drawable/settings"
android:showAsAction="always">
<menu>
<item
android:id="@+id/preferences"
android:icon="@drawable/preferences"
android:showAsAction="always"
android:title="@string/preferences_menu_settings_text"/>
<item
android:id="@+id/sorting"
android:icon="@drawable/sort"
android:showAsAction="always"
android:title="@string/preferences_menu_sorting_text">
<menu>
<group android:checkableBehavior="single" >
<item
android:id="@+id/sortingNewActiveMenu"
android:checked="true"
android:title="@string/preferences_menu_sorting_new_text"/>
<item
android:id="@+id/sortingOlderActiveMenu"
android:title="@string/preferences_menu_sorting_older_text"/>
</group>
</menu>
</item>
</menu>
</item>
</menu>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question