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
Derron Blake
566 PointsPretty little things code challenge "Animate Answer
I am new at programming and i am stuck at a code challenge.
//this is line one of the code which is given:
TextView statusLabel = (TextView) findViewById(R.id.statusLabel)
//this is what i have coded:
statusLabel.setAnimation(fadeOutAnimation);
AlphaAnimation fadeOutAnimation = new AlphaAnimation(1, 0);
//what am i doing wrong?
3 Answers
Ben Jakuben
Treehouse TeacherHi @Derron,
Welcome! If that is the code exactly as you have it in the challenge, then you have everything right but in the wrong order. When you call statusLabel.setAnimation(fadeOutAnimation);, the fadeOutAnimation variable must already exist and be set for it to make sense. The code you pasted has you declaring and setting that variable on the next line, which means it isn't available when you need it.
Programming is extremely literal and the order of things is very important.
Also, if you want your code to be formatted nicely in the forum, you can either indent each line four spaces or surround your code with special tags. Three backticks followed by "java" on the line above the code and three backticks below it, like this:
```java
String test = "this is a test";
```
String test = "this is a test";
Derron Blake
566 PointsThanks Ben your advice was spot on. This is my maiden voyage at programming and I know I have lots to learn, but I welcome the challenge. Thanks again for the quick response.
Ben Jakuben
Treehouse TeacherAwesome - so glad you're with us! Stop by here in the forum with any other questions.
larsfredrik
2,943 Pointslarsfredrik
2,943 PointsI'm also stuck, and I don't understand your answer. Could you please be a little more detailed?
Thanks! :-)
larsfredrik
2,943 Pointslarsfredrik
2,943 PointsForget it. I made it! :-)
Ben Jakuben
Treehouse TeacherBen Jakuben
Treehouse TeacherGlad you got it! :)