Android Action bar


Action Bar in Android is used to provide navigation and to perform some actions. In this tutorial we are going to implement a Simple Action Bar in our Android Application and perform actions such as switching fragments , speech recognition. More Advanced implementation will be covered in another article.  To support older version of Android use Android Support Library.


Just crate provide with some name, after creating the project nothing is required in & activity_main.xml like below


After this in create one folder with “menu.xml” in in res

Right click on res and select new and directory give name asvmenu then click ok


Create one xml file in menu folder

Right click on menu and select new and layoutresouce give name as main-menu then click ok

After that add below code in main_menu.xml


Create One java file in src with the name of and write below code in java file


Finally Which are the other classes are their you change instead of  “extends AppCompatActivity”  you change “extends Menuoptions” like below in all classes.


Just run and check the output

Leave a Reply