Best code examples for Android MenuItem class (android.view.MenuItem)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android MenuItem class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android MenuItem examples from Open Source projects
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
89:	switch (item.getItemId()) { 
-
92:	(AdapterView.AdapterContextMenuInfo)item.getMenuInfo(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
56:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
90:	switch (item.getItemId()) { 
-
93:	(AdapterView.AdapterContextMenuInfo)item.getMenuInfo(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
81:	if (super.onOptionsItemSelected(item) == true) { 
-
85:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setIntent, setShowAsAction, setVisible
98:	helpMenuItem.setIntent(intent); 
99:	helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); 
100:	helpMenuItem.setVisible(true); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
70:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setActionView, setIcon, setShowAsAction
76:	item.setIcon(android.R.drawable.ic_menu_search); 
77:	item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM 
-
81:	item.setActionView(sv); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId
67:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
89:	switch (item.getItemId()) { 
-
92:	(AdapterView.AdapterContextMenuInfo)item.getMenuInfo(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
111:	if (!super.onContextItemSelected(item)) { 
112:	switch (item.getItemId()) { 
-
115:	.getMenuInfo(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
313:	switch (item.getItemId()) { 
-
315:	ContextMenu.ContextMenuInfo menuInfo = item.getMenuInfo(); 
-
322:	return super.onContextItemSelected(item); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
83:	AdapterContextMenuInfo adapterContextMenuInfo = (AdapterContextMenuInfo) item.getMenuInfo(); 
-
86:	switch (item.getItemId()) { 
-
95:	return super.onContextItemSelected(item); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getGroupId
28:	if(item.getGroupId() == 2) { 
29:	open(item); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setActionView, setIcon, setShowAsAction
97:	item.setIcon(android.R.drawable.ic_menu_search); 
98:	item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM 
-
102:	item.setActionView(sv); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isCheckable, isChecked, setChecked
195:	Assert.assertTrue("Item was not set to checkable", item1.isCheckable()); 
196:	item1.setChecked(true); 
197:	Assert.assertTrue("Item did not get checked", item1.isChecked()); 
-
201:	Assert.assertFalse("Item was not unchecked due to exclusive checkable", item1.isChecked()); 
-
205:	Assert.assertTrue("Item was not set to checkable", item1.isCheckable()); 
206:	item1.setChecked(false); 
207:	Assert.assertFalse("Item did not get unchecked", item1.isChecked()); 
208:	item1.setChecked(true); 
209:	Assert.assertTrue("Item did not get checked", item1.isChecked()); 
-
212:	Assert.assertTrue("Item was unchecked when it shouldnt have been", item1.isChecked()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId
72:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setOnMenuItemClickListener
96:	item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
137:	AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); 
-
139:	switch (item.getItemId()) { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setChecked, setShowAsAction
146:	menuItem.setChecked(item.checked) 
-
153:	menuItem.setShowAsAction(item.showAsAction); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getSubMenu, hasSubMenu
91:	if (item.hasSubMenu()) { 
92:	if (item.getSubMenu().size() == 0) return; 
93:	showMenu(item.getSubMenu()); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setIntent, setShowAsAction, setVisible
98:	helpMenuItem.setIntent(intent); 
99:	helpMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); 
100:	helpMenuItem.setVisible(true); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getGroupId
29:	if(item.getGroupId() == 1) { 
30:	open(item); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
89:	AdapterContextMenuInfo adapterContextMenuInfo = (AdapterContextMenuInfo) item.getMenuInfo(); 
-
92:	switch (item.getItemId()) { 
-
101:	return super.onContextItemSelected(item); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setActionView, setIcon, setShowAsAction
100:	item.setIcon(android.R.drawable.ic_menu_search); 
101:	item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM 
-
105:	item.setActionView(sv); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getMenuInfo
63:	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getActionView, isEnabled, isVisible, setActionView, setEnabled
78:	return menuItem.getActionView(); 
-
163:	return menuItem.isEnabled(); 
-
168:	return menuItem.isVisible(); 
-
188:	return menuItem.setActionView(view); 
-
221:	return menuItem.setEnabled(enabled); 
-
231:	return menuItem.setIcon(icon); 
-
314:	return menuItem.setVisible(visible); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
97:	switch(item.getItemId()) { 
-
99:	AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId
77:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId, getMenuInfo
97:	switch(item.getItemId()) { 
-
99:	AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getItemId
78:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
105:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
78:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
131:	if (item.getItemId() == 0) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
73:	if(OFAndroid.menuItemSelected(item.getItemId())){ 
-
77:	return super.onOptionsItemSelected(item); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
30:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
63:	switch (item.getItemId()) { 
-
70:	return(super.onOptionsItemSelected(item)); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getItemId
32:	switch (item.getItemId()) { 
Full Snippet Info
8
CodeRank
Related Android MenuItem Questions & Answers:
Other Android MenuItem Examples
40:	
41:	  @Override
42:	  public boolean onOptionsItemSelected(MenuItem item) {
43:	    Toast.makeText(this, "Just a test", Toast.LENGTH_SHORT).show();
44:	    return true;

Read More

6:		 * */
7:		@Override
8:		public boolean onOptionsItemSelected(MenuItem item) {
9:			// Take appropriate action for each action item click
10:			switch (item.getItemId()) {

Read More

28:	     * */
29:	    @Override
30:	    public boolean onOptionsItemSelected(MenuItem item)
31:	    {
32:

Read More

24:	
25:		// Refresh menu item
26:		private MenuItem refreshMenuItem;
27:	
28:		@Override
-
43:		 * */
44:		@Override
45:		public boolean onOptionsItemSelected(MenuItem item) {
46:			// Take appropriate action for each action item click
47:			switch (item.getItemId()) {

Read More

1:	@Override
2:	public boolean onOptionsItemSelected(MenuItem item) {
3:	    switch (item.getItemId()) {
4:	        case R.id.vibrate:

Read More

1:	@Override
2:	public boolean onOptionsItemSelected(MenuItem item) {
3:	    // Handle item selection
4:	    switch (item.getItemId()) {

Read More

1:	@Override
2:	public boolean onContextItemSelected(MenuItem item) {
3:	    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
4:	    switch (item.getItemId()) {

Read More

See Code Examples for Android MenuItem Methods: