Android Action bar

719 views.

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.

Step1:

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

ActivityMain.java

Step2:

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

Step3:

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

Step4:

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

Step5:

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

Step6:

Just run and check the output

You may also like...

Leave a Reply