I am writing an Android app where the user must choose how and what to display on a graph. These options are expressed in two single-selection menu groups (radio but
I found an elegant way to solve this that was unfortunately not in the documentation. Add the following code to your ActionBar menu XML:
<item android:id="@+id/menu_openothermenu"
android:title="@string/openothermenustr"
android:showAsAction="always">
<menu>
<group android:checkableBehavior="single">
<item android:id="@+id/menu_2_choice_1" android:title="@string/2_choice_1" android:showAsAction="never" />
<item android:id="@+id/menu_2_choice_2" android:title="@string/2_choice_2" android:showAsAction="never" android:checked="true" />
</group>
</menu>
</item>
No extra handler code or popup menu implementation is necessary for such a menu to appear.