In the fragment activity where you want to have the menu (Make sure you are importing android.support.v4.app.FragmentActivity):
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_menu, 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="http://schemas.android.com/apk/res/android" > <item android:id="@+id/itemId" android:icon="@drawable/ic_launcher" android:showAsAction="ifRoom|withText" android:title="@string/yourString"/> </menu>