Code example for MenuItem

Methods: setIcon

0
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		MenuItem homeItem = menu.add(0, 0, 0, "Home");
		MenuItem aboutItem = menu.add(0, 1, 0, "Help");
		aboutItem.setIcon(android.R.drawable.ic_menu_info_details);
		homeItem.setIcon(android.R.drawable.ic_menu_edit);
		return true; 
	} 
 
	@Override 
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case 0: 
			Intent i = new Intent(About.this, Home.class);
			if (extras != null) {
				i.putExtras(extras);
			} 
			startActivity(i);
			return true; 
		case 1: 
			Intent j = new Intent(About.this, Help.class);