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 trialKeishi Mii
3,122 PointsApp keeps crashing after the step where the background should be switching colors randomly
I have followed the video exactly, but when I try to run the app it will just force exit the application instead of switching colors.
2 Answers
Andrei Fecioru
15,059 PointsHi,
Can you please post the code of the activity which is causing the application crash as well as some logcat
output?
Thanks.
Martin Georgiev
13,541 PointsHey,
I have the same issue as well. After adding an Id to the RelativeLayout and trying to change it dynamically my app crashes. I receive the following error: "Caused by: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.RelativeLayout" showing the error on line 23 where I have: final RelativeLayout relativeLay = (RelativeLayout) findViewById(R.id.relativeLay);
I double-checked the code provided by the tutorial and what I have, Id, classes, methods etc...
update: I moved back several steps and tried to run the app without any color related code. It turns out that as soon as I put an ID on the RelaviteLayout the app crashes.