Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Blog Reader Android App Exploring the Master-Detail Template Blog Reader Project Overview

Challenge task 4 of 4 in Android development – Blog Reader Project Overview

Hello. In this task I do receive a message saying “The second parameter (“String message”) of the Log.d() method must equal the value specified in the instructions” and instruction states that I need to use the “message” variable as the second parameter. Please see the code below;

String title1 ="Android is awesome"; String title2 ="Mike is cool"; String title3 ="Treehouse loves me"; String[] titles = { title1, title2, title3 }; String message = ""; message = titles[1]; Log.d("CodeChallenge", "titles[1]");

Can anyone please tell me what am I doing wrong ?

8 Answers

Valery Kukatov
Valery Kukatov
6,996 Points

Oh. Don't use quotes on message. Quotes turn it into a string basically.

Valery Kukatov
Valery Kukatov
6,996 Points

May be the space between String[] and titles = [title1...] is what causing the error?

Hi,

Not quite. The line that causes the error is -- Log.d("CodeChallenge", "titles[1]") --. As a second variable i need to use "message" variable so i did, however it still gives me an error.

Valery Kukatov
Valery Kukatov
6,996 Points

I'm guessing what it's actually saying... instead of actually typing 'titles[1]' , you need to type in 'message'

Thats what i thought at first however it still doesn't work. Any ideas ?

Valery Kukatov
Valery Kukatov
6,996 Points

Let's format your code and take it slow.

String title1 ="Android is awesome"; 
String title2 ="Mike is cool"; 
String title3 ="Treehouse loves me";
 String[] titles = { title1, title2, title3 };     // Everything looks good till here.
String message = ""; message = titles[1];  /* I looked in the challenge and it 
doesn't ask to input String message as blank. 
Here you are assigning a blank message and then 
assigning to message to be something else. 
You are creating an unnecessary step  */
Log.d("CodeChallenge", "titles[1]"); // Here you need to just replace 'titles[1]' with String 'message'

This worked for me.

I'm clearly missing something. Sorry for being a pain but it still doesn't work for me, I've tried multiple times and variances, still nothing.

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");

Thanks

OMG, i finally did it!

Thank you for your help, much appreciated.