Adding alphabetical shortcut to the menu item in Android

There is a way to add alphabetical shortcut to your menu item.
I am going to show how it can be done.

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

As you can see it is very easy.

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

Share

No related posts.

Leave a Reply

  

  

  

You can use these HTML tags

<a href=""title=""><abbr title=""><acronym title=""><b><blockquote cite=""><cite><code><del datetime=""><em><i><q cite=""><strike><strong>

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna,tincidunt vitae molestie nec,molestie at mi. Nulla nulla lorem,suscipit in posuere in,interdum non magna.