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 trialWai Leung Chan
17,417 PointsCannot launch the app
"Unfortunately, Crystal Ball has stopped" pops up when I launch the app. I have followed the instructions to avoid Theme Error. What's the problem...
1 Answer
Ben Junya
12,365 PointsI had this problem too! The guy who made the course gave me this solution. It worked perfectly.
Change your project back to using "AppTheme" like it was before. Then we're going to customize the AppTheme itself:
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>
Here's what the whole file should look like (you can just copy/paste this if you want):
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:windowNoTitle">true</item> <!-- Hides the Action Bar -->
<item name="android:windowFullscreen">true</item> <!-- Hides the status bar -->
</style>
</resources>
Now add the following line to your RelativeLayout element:
android:background="@android:color/black"
Here's what it looks like together:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="top" android:background="@android:color/black" tools:context=".MainActivity" >
... rest of code ...
For the TextView in the center, it crashed on me when I tried to center it. For the sake of preserving sanity, copy and paste this code for your TextView in the layout file:
<TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:layout_centerVertical="true" android:shadowColor="@android:color/white" android:shadowRadius="10" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#FFFFFF" android:textSize="32sp" />
If you're STILL crashing, try cleaning and rebuilding the app:
Project > Clean in Eclipse Uninstall from the emulator Run the project from Eclipse
That should fix it. Hit me up if you're having more problems!
Ben Junya
12,365 PointsBen Junya
12,365 PointsFormatting screwed up just a little bit. For where it says "rest of code..." It should read this:
Wai Leung Chan
17,417 PointsWai Leung Chan
17,417 PointsIt works now! Thanks so much Ben!