MENU IN DIALOG ;

agosto 17, 2018 doido 2.0 0 Comments


registerForContextMenu(listview1);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle("Select the Action");
menu.add(0,v.getId(),0,"Delete");
menu.add(0,v.getId(),0,"UpperCase");
menu.add(0,v.getId(),0,"LowerCase");
}
@Override
public boolean onContextItemSelected(MenuItem item) {
if(item.getTitle()=="Delete") {
Toast.makeText(this, "Delete was pressed", Toast.LENGTH_SHORT).show();
} else if(item.getTitle()=="UpperCase") {
Toast.makeText(this, "UpperCase was pressed", Toast.LENGTH_SHORT).show();
} else if(item.getTitle()=="LowerCase") {
Toast.makeText(this, "LowerCase was pressed", Toast.LENGTH_SHORT).show();
}
return true;

0 Comments: