OK, I\'ve been extending my activities to
extends ActionBarActivity
My main menu page
extends FragmentActivity
Experienced same problem and the solution, as mentioned in other responses, is to edit your ActionBarActivity
class.
This class is defined in your code (com.google.android.actionbarcompat
). The only thing you have to do is change extends Activity
to extends FragmentActivity
from the android.support.v4.app.FragmentActivity
.
ActionBarActivity extends android.support.v4.app.FragmentActivity, so ActionBarActivity serves both purposes.
Do you have menu items for your Fragments? Use your own app
namespace instead of android
for app:showAsAction
and app:actionLayout
, etc.
To add your namespace to the XML use this line in the menu
tag
xmlns:app="http://schemas.android.com/apk/res-auto"
E.g.
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_settings" app:showAsAction="ifRoom" android:title="@string/menu_settings" android:orderInCategory="100" />
</menu>
Note the app:showAsAction
rather than android:showAsAction
Is your code from the Action Bar compatibility example that comes with the SDK? If so just change the ActionBarActivity class in that example to extend FragmentActivity (from the compatibility library I assume) instead of Activity.