At runtime I would like to add an item inside this group (in my options menu):
<item
android:id="@+id/action_module_selector"
android:alphabeticShortcut="m"
android:orderInCategory="30"
android:title="@string/module_selector_menu_title"
app:showAsAction="never">
<menu>
<group
android:id="@+id/group_modules"
android:checkableBehavior="single">
<!-- Modules should be added here at runtime -->
</group>
</menu>
</item>
If I call subMenu.add(R.id.group_modules, moduleId, 1, title);
they end up at the same level as the group, not inside the group, although I use R.id.group_modules
. I would like to know how I can add them inside the group.