Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can I use a compatible action bar AND a fragment in the same activity?

Tags:

OK, I've been extending my activities to

extends ActionBarActivity

My main menu page

extends FragmentActivity

when I change it to extend ActionBarActivity so I can see my action bar title on the main menu, it throws up and gives me the "Error Inflating Class Fragment" error.

Is there any way around this?

like image 867
Jarrette Avatar asked Jan 27 '12 21:01

Jarrette


2 Answers

ActionBarActivity extends android.support.v4.app.FragmentActivity, so ActionBarActivity serves both purposes.

like image 132
user1350972 Avatar answered Oct 26 '22 15:10

user1350972


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.

like image 33
michaelg Avatar answered Oct 26 '22 14:10

michaelg