W
W
web_dev2013-10-20 00:00:32
Android
web_dev, 2013-10-20 00:00:32

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);

Thank you!
@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

1 answer(s)
T
Terranz, 2013-10-21
@Terranz

I don’t see any problems
, first take topMenuActionBar, then find id.sorting in it, and already in it you will find your sortingOlderActiveMenu

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question