Android: How to include a menu xml inside another menu xml?

MayoliWakly

New Member
Simple question. I have my menu of child items: \[code\]<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/fp_pitcher" android:title="Pitcher"> </item> <item android:id="@+id/fp_catcher" android:title="Catcher"> </item><!-- SNIP ---> </menu>\[/code\]And later I would want to include it as a submenu of this menu: \[code\]<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/teameditor_remove" android:title="Remove Player from Team"> </item> <item android:id="@+id/teameditor_assignbattingposition" android:title="Assign Batting Position"> </item> <item android:id="@+id/teameditor_assignfieldingposition" android:title="Assign Feilding Position"> <!-- I want to include the submenu here--> </item></menu>\[/code\]The question here kind of answered this - I'm not sure how to inflate the submenu. I'm thinking that you inflate it in the onContextItemSelected method - but inflate requires a menu object, which isn't passed into onContextItemSelected.
 
Back
Top