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
nolantenpas
15,573 PointsPossible error on the Android code challenge: blog reader project overview
I got the first three tasks right but when it comes to the fourth task I keep getting a compilation error.
The task is: Finally, write the 'message' variable to the log using the Log.d() method. For the first parameter of Log.d() (the tag), use “CodeChallenge”, and use the 'message' variable as the second parameter.
my code is: String title1 = "Android is awesome"; String title2 = "Mike is cool"; String title3 = "Treehouse loves me"; String [] titles = {title1, title2, title3}; String message = titles[1]; Log.d(CodeChallenge, message);
Could this be a possible error? I am almost positive my code is correct.
5 Answers
ecp
838 PointsHi Nolan! Sorry that you're experiencing this issue. Would you mind either posting a link in reply to this Forum post to the code challenge in question and a screenshot? Alternatively, could you shoot me an email at help@teamtreehouse.com with the link + screenshot?
We're unsure of what code challenge you're on and need a little more detail. Screenshots will help us see what quiz or code challenge your on, what it is asking you exactly, what your answer is, and what the error message or hint says to you when it pops up. :)
Ben Jakuben
Treehouse TeacherSo close! You're just missing two key double-quotes. Reply in this thread if you need more details than that.
andrea stockwell
Courses Plus Student 1,547 PointsI am having the same issue. "Compilation error" I ran the following code in the emulator and compiles fine and I get the message string "Mike is cool" in my debug log. Hmmm.. Here is my code.
package com.example.test2;
import android.app.Activity; import android.os.Bundle; import android.util.Log;
public class CodeChallenge extends Activity {
public static final String TAG = CodeChallenge.class.getName();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String title1 = "Android is awesome";
String title2 = "Mike is cool";
String title3 = "Treehouse loves me";
String titles[] = {title1, title2, title3};
String message = titles[1];
Log.d(TAG, message);
}
}
Ben Jakuben
Treehouse TeacherIn this Code Challenge, instead of using a variable named TAG like we normally do, we're simply typing the String "CodeChallenge" as the first parameter of the Log.d() method. Try that and you should be all set!
andrea stockwell
Courses Plus Student 1,547 PointsAhhh. I was using a pistol when all I needed was a bow and arrow for this code challenge! Booya!
Thanks for the quick response!