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 trialPapaijas jr.
8,016 PointsAndroid Blog Reader Challenge(PLEASE HELP!!!!!!!!!)
Need help!! Declare a constant String variable named URL and set it to "teamtreehouse.com". Declare it as a static constant like we saw in the video. Thank you!
6 Answers
Jason Thorn
2,611 Pointsvery close :) it should be:
public static final String URL ="teamtreehouse.com";
Sorry if i mislead you with my parenthesis.
Jason Thorn
2,611 PointsAnd don't forget you need to add it outside of the onCreate() method.
Jason Thorn
2,611 PointsHi Papaijas,
public static final String = (I'll leave the rest to you :) )
Papaijas jr.
8,016 PointsAm I even close? public static final String = (teamtreehouse.com);
Juan Gallardo
1,568 PointsWhat needs to be added is
public static final String URL ="teamtreehouse.com";
It needs to be added outside of the onCreate() method. Which means that this is how the entire file looks
package com.example;
import android.os.Bundle;
import android.view.View;
import java.net.MalformedURLException;
import android.util.Log;
public class MainListActivity extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_list);
// Add Task 2 code here
}
public static final String URL ="teamtreehouse.com";
}
Stephen Amaza
1,549 PointsIt worked for me. But can you briefly explain why we add it outside the method at the bottom? Thank you
Papaijas jr.
8,016 PointsThank you!:)
Juan Gallardo
1,568 PointsJuan Gallardo
1,568 PointsYou did not add enough "!" hence why you did not get an answer on time ;)