I want to add the menu items dynamically. I have menu like this:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/allItems"
        android:showAsAction="always"
        android:title="@string/trackAll"/>
    <item
        android:id="@+id/specficItems"
        android:showAsAction="always"
        android:title="@string/trackSpecific"/>
    <item
        android:id="@+id/favItems"
        android:showAsAction="always"
        android:title="@string/trackFav"/>
</menu>
I try to add items into favItems.
But when I try like this :
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.admin_menu, menu);
    MenuItem item=menu.findItem(R.id.favItems);
    menu.add(0, MY_MENU_1, 0, "Item 1").setShortcut('3', 'c');
    menu.add(0, MY_MENU_2, 0, "Item 2").setShortcut('4', 's');
    menu.add(0, MY_MENU_3, 0, "Item 3").setShortcut('5', 'z');
    return true;
}
The output is coming like this:

But I want to add this items into favItems
Please let me know any idea to add the items dynamically in favItems.
If I try like this:
@Override
    public boolean onPrepareOptionsMenu(Menu menu) {    
    menu.add(0, MY_MENU_1, 0, "Item 1").setShortcut('3', 'c');
    menu.add(0, MY_MENU_2, 0, "Item 2").setShortcut('4', 's');
    menu.add(0, MY_MENU_3, 0, "Item 3").setShortcut('5', 'z');
    return super.onPrepareOptionsMenu(menu);
    }
The op coming like this:

 
     
    