Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Andrew Zhang
4,364 PointsgetActionBar now returns null
After adding the style files from android.holo, I can't open the app anymore.
The problem is I'm getting a null pointer when the getActionBar is called.
Through debugging it shows:
ActionBar actionBar = getActionBar();
actionBar is null. Anyone know why this is the case?
Cheers
1 Answer
Andrew Zhang
4,364 PointsOk, Solved my own problem
For anyone else having the same problem, this is what I had to do:
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
Instead of the simple getActionBar() method.
Hope this helps.