Option Menu-Android

by Murtaza FarhatYar | 22 Jan 2019

Menu is one of the most useful and important component/widget. As menu has many different types as their usages differ. In this article we are going to be familiar with option menu in android.

follow the following steps and points.

First step:

In beginning you have to create the menu directory as bellow:


Second step:

Keep in mind that the directory name must be menu, nothing else:


Third step:

right click on menu that you have created and add the menu resource file as bellow.

Fourth step:

give a name for menu resource file.

Fifth step:

after creating menu resource file, write the following codes in option_menu_src file.

See also: Dynamic ListView – Android
Sixth step:

the last step is adding the related codes in MainActivity.java.

The result is:


for more follow us on