Add Options Menu in Android

I have tried to add options menu to my application, but when adding a Create Options Menu to the code it is not used. It looks like this:

IDE snapshot showing unused handler

I used in this page on Fragment Activity and implements Tab Listener.

What is the right way to add the Options Menu?


In the fragment activity where you want to have the menu (Make sure you are importing

public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(, menu);
    return super.onCreateOptionsMenu(menu);

In res/menu folder you should have this file: main_menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="" >


Leave a Reply

Your email address will not be published. Required fields are marked *