Adding icons

Icons can also be added to items that appears in the Icon Menu with setIcon() . For example:

.setIcon(R.drawable.menu quit icon);

tj public void onCreateContextMenu(ContextMenu menu, View v,

ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); menu.add(0, EDIT_ID, 0, "Edit"); menu.add(0, DELETE_ID, 0, "Delete");

public boolean onContextItemSelected(MenuItem item) {

AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case EDIT_ID:

editNote(info.id);

0 0

Post a comment