I have a parsed xml file and now I want to create a dynamic UI in a hierarchically way. For example:
1
1.1
1.2
2
2.1
3
3.1
3.1.1
Every menu that has a submenu is tagged with a name "menu", and the menu that is an action is tagged as "action". Can you please help me in implementing this? I know the logic is wrong, I'm currently working on it but here is what I'm trying to do:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
this.mymenu=menu;
Iterator<Option> it= optionList.iterator();
int count=0;
while(it.hasNext()){
Option e= (Option)it.next();
if(e.getType().equals("menu")){
count++;
menu.add(0,count,0,e.getName());
}
}
getMenuInflater().inflate(R.menu.parser, menu);
return true;
}