Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Can someone help with android theme?
Hey guys, I'm having a problem with my app, in which I can only use the default app theme in order for my app to work. If I put a another theme in, the app will crash. I only want my app to have the theme.black.NoTitleBar.fullscreen. Is there any way for me to apply this theme without having my app crashing.
It's a bug in the ADT as I suppose
The error relates to java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
The video in treehouse uses the Theme called ** Theme.Black.NoTitleBar.Fullscreen ** . Are you using this?
If yes, then the new android update no longer supports this. However there is a work around as proposed by treehouse
1) Change your project back to using "AppTheme" like it was before in AndroidManifest.xml and the preview.
2) Add the following two lines to the file res/values/styles.xml (inside the <style name="AppTheme"> tag):
<item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">true</item>
3) Set the background color to black in the file res/layout/activity_main.xml. The root element, RelativeLayout, is the one that makes up the whole screen. Add this line after the layout_height line but before the closing angle bracket >:
4) Change MainActivity to extend Activity, not ActionBarActivity
Hope this helps. Ask again if you have doubts.
Extend is a keyword in Java that implies inheritance.
By convention it means remove ActionBar from ActionBarActivity so that it reads Activity in your MainActivity.java file
Hope I made sense. Ask again if you have a doubt