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 trialJunaid Shaikh
Courses Plus Student 1,533 PointsMy app is not working
My app is stuck and showing the message that the Unfortunately Crystal Ball has stopped working please help i want to learn and finish my course and start with my new skill very fast please help please
2 Answers
Calvin Nix
43,828 PointsJunaid,
By reviewing your AndroidManifest.xml file I believe I have found your issue.
android:theme="@android:style/Theme"
This needs to be...
android:theme="@style/AppTheme"
Calvin Nix
43,828 PointsHello Junaid,
Have you followed the "Teacher's Notes" under the video?
" Teacher's Notes Known Issues
Theme Error: The Android tools have been updated and the theme we use, Theme.Black.NoTitleBar.Fullscreen, may no longer work for you. If you run the app and get an error, you need to use the following workaround:
**Download files if you want to use these as replacements or for copy/paste: styles.xml | activity_main.xml
1) Change your project back to using "AppTheme" like it was before.
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 >:
android:background="@android:color/black"
If you are having trouble with the Action Bar still showing, you may also need to change MainActivity to extend Activity, not ActionBarActivity. "
Junaid Shaikh
Courses Plus Student 1,533 PointsI added both the lines in the correct path but the app is still not working .....
Calvin Nix
43,828 PointsDid you also remember to edit you manifest?
Junaid Shaikh
Courses Plus Student 1,533 PointsWhat to Edit please help me!!!
Calvin Nix
43,828 PointsAndroidManifest.xml
If I recall correctly you edited that originally when you changed the theme. You will need to change that back to the original.
Junaid Shaikh
Courses Plus Student 1,533 PointsYes i did it...Sorry i dint do it can you write the code to change it to app theme again
Calvin Nix
43,828 PointsI would recommend to re-trace your steps to ensure that you didn't miss any details. If that still doesn't work you can post styles.xml and activity_main.xml and I will take a look at it.
Junaid Shaikh
Courses Plus Student 1,533 Points... android:theme="@android:style/app theme" > ... Its giving me an error
Calvin Nix
43,828 PointsI believe that is supposed to be android:theme="@android:style/AppTheme"
Junaid Shaikh
Courses Plus Student 1,533 PointsIts giving an error
Calvin Nix
43,828 PointsWhat does the error message say?
Junaid Shaikh
Courses Plus Student 1,533 Pointsits saying no resource found with the name android:theme="@android:style/AppTheme"
Calvin Nix
43,828 PointsAt the top of the graphical editor you should see an option to edit the Theme from there. Change the theme to AppTheme here instead of going through the XML file and doing it manually.
Junaid Shaikh
Courses Plus Student 1,533 Pointsi will send you styles.xml and activity_main.xml please take a look at it
Junaid Shaikh
Courses Plus Student 1,533 Points<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">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
Junaid Shaikh
Courses Plus Student 1,533 Pointsand my activity_main,xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="match_parent" android:background="@android:color/black" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:scaleType="fitCenter"
android:src="@drawable/ball01" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center_horizontal"
android:shadowColor="@android:color/white"
android:shadowRadius="10"
android:textColor="@android:color/white"
android:textSize="32sp" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageView1"
android:layout_alignParentBottom="true"
android:text="Enlighten ME!!!"
android:textColor="#3f0f7f"
android:textSize="24sp"
android:textStyle="italic|bold"
android:typeface="serif" />
</RelativeLayout>
Calvin Nix
43,828 PointsThose files appear to be correct. Please post your AndroidManifest.xml file.
Junaid Shaikh
Courses Plus Student 1,533 Points<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.crystallball" android:versionCode="1" android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme" >
<activity
android:name="com.example.crystallball.MainActivity"
android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Junaid Shaikh
Courses Plus Student 1,533 Points<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.crystallball" android:versionCode="1" android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme" >
<activity
android:name="com.example.crystallball.MainActivity"
android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Junaid Shaikh
Courses Plus Student 1,533 Points<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.crystallball" android:versionCode="1" android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme" >
<activity
android:name="com.example.crystallball.MainActivity"
android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Junaid Shaikh
Courses Plus Student 1,533 PointsJunaid Shaikh
Courses Plus Student 1,533 PointsThanksssssssssssss a lot it has started working thanks i will never forget what have you done to me, best wishes for your future from bottom of my heart ...... and stay with me for future help ... i want to become an android developer
Calvin Nix
43,828 PointsCalvin Nix
43,828 PointsYou are very welcome! Keep up the hard work.