Home > Android, Android how to, Menu > Adding alphabetic shortcut to the menu item in Android

Adding alphabetic shortcut to the menu item in Android


We moved. Please visit this link for this post.

 

 

 

There is a way to add shortcut to your menu item.

I am going to show how it can be done.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
	menu.add(0, NEW_MENU_ITEM, 0, "New").setAlphabeticShortcut('N');
...
	return super.onCreateOptionsMenu(menu);
}

As you see it is very easy.
How you can test it? Run your code with this snippet, click Menu button and after click “N”.

Advertisements
Categories: Android, Android how to, Menu
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: