Some of you guys have great answers, but I found some additional thing. If you want create a MenuItem with some SubMenu programmatically:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
SubMenu subMenu = menu.addSubMenu(0, Menu.NONE, 0, "Menu title");
subMenu.getItem().setIcon(R.drawable.ic_action_child);
subMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
subMenu.add(0, Menu.NONE, 0, "Subitem 1");
subMenu.add(0, Menu.NONE, 1, "Subitem 2");
subMenu.add(0, Menu.NONE, 2, "Subitem 3");
return true;
}