public classs Main extends Activity
{
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.addSubMenu(NONE, 0, NONE, "Add Item");
menu.addSubMenu(NONE, 1, NONE, "Delete All");
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if(id==0)
{
intent=new Intent(portfolio.this,add_item.class);
try {
startActivity(intent);
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
if(id==1)
{
dh.deleteAll();
}
return true;
}
}