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 trialCarl Taggett
10,319 PointsAndroid Question BlogReader Getting Data from the Web: Trying Code and Catching Exceptions
Declare a constant String variable named URL and set it to "teamtreehouse.com". Declare it as a static constant like we did in the video?
static final String URL = (teamtreehouse.com); ????
5 Answers
Paul Stevens
4,125 PointsHello,
I think instead of brackets you need speech marks around the value:
static final String URL = "teamtreehouse.com";
Paul :)
Paul Stevens
4,125 PointsHello,
You need to set the variable as public as well. Also the line should go above the @override.
package com.example;
import android.os.Bundle;
import android.view.View;
import java.net.MalformedURLException;
import android.util.Log;
public class MainListActivity extends ListActivity {
//Declare a constant String variable named URL and set it to "teamtreehouse.com".
public static final String URL = "teamtreehouse.com";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_list);
// Add Task 2 code here
}
}
Hope this helps, Paul :)
Carl Taggett
10,319 Pointspackage 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);
static final String URL = "teamtreehouse.com";
// Add Task 2 code here
}
}
this the code i have however not working not sure what i'm missing
Carl Taggett
10,319 Pointsgot it! thanks for the help ;)
Paul Stevens
4,125 PointsNo problem :D