I have created my parent menus in xml , now i don't know how to create submenus under those parents using code. That means , parents are coded in menu.xml and submenus will be loaded based on a dynamic code as and when the data is available.
When i tried to use menu.addSubMenu it is creating a new parent menu item.
I know this is a very very old thread but hopefully this will help others like me who had the same requirement.
menu/movies.xml
:then programmatically on your
activity/fragment
:Hope this helps.
okk.. you should try this..
mymenu.xml:
Then later in code: