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
Christopher Cooper
1,133 PointsOpening a Webpage in the Browser
Not too sure what is going on but I am getting the following errors:
JavaTester.java:1: package android.os does not exist import android.os.Bundle; ^ JavaTester.java:2: package android.view does not exist import android.view.View; ^ JavaTester.java:3: package android.view does not exist import android.view.ListView; ^ JavaTester.java:4: package android.content does not exist import android.content.Intent; ^ JavaTester.java:5: package android.net does not exist import android.net.Uri; ^ ./CustomListActivity.java:1: package android.os does not exist import android.os.Bundle; ^ ./CustomListActivity.java:2: package android.widget does not exist import android.widget.ArrayAdapter; ^ ./CustomListActivity.java:3: package android.view does not exist import android.view.View; ^ ./CustomListActivity.java:4: package android.view does not exist import android.view.ListView; ^ ./CustomListActivity.java:5: package android.content does not exist import android.content.Intent; ^ ./CustomListActivity.java:6: package android.net does not exist import android.net.Uri; ^ ./ListActivity.java:1: package android.os does not exist import android.os.Bundle; ^ ./ListActivity.java:2: package android.widget does not exist import android.widget.ArrayAdapter; ^ ./ListActivity.java:3: package android.app does not exist import android.app.Activity; ^ ./ListActivity.java:4: package android.view does not exist import android.view.View; ^ ./ListActivity.java:5: package android.view does not exist import android.view.ListView; ^ ./ListActivity.java:7: cannot find symbol symbol: class Activity public class ListActivity extends Activity { ^ ./CustomListActivity.java:13: cannot find symbol symbol : class Bundle location: class CustomListActivity public void onCreate(Bundle savedInstanceState) { ^ ./CustomListActivity.java:22: cannot find symbol symbol : class ListView location: class CustomListActivity protected void onListItemClick(ListView l, View v, int position, long id) { ^ ./CustomListActivity.java:22: cannot find symbol symbol : class View location: class CustomListActivity protected void onListItemClick(ListView l, View v, int position, long id) { ^ ./ListActivity.java:13: cannot find symbol symbol : class ArrayAdapter location: class ListActivity public void setListAdapter(ArrayAdapter adapter) { ^ ./ListActivity.java:17: cannot find symbol symbol : class ListView location: class ListActivity protected void onListItemClick(ListView l, View v, int position, long id) { ^ ./ListActivity.java:17: cannot find symbol symbol : class View location: class ListActivity protected void onListItemClick(ListView l, View v, int position, long id) { ^ JavaTester.java:28: cannot find symbol symbol : class ListView location: class JavaTester activity.onListItemClick(new ListView(), new View(), 0, 1); ^ JavaTester.java:28: cannot find symbol symbol : class View location: class JavaTester activity.onListItemClick(new ListView(), new View(), 0, 1); ^ JavaTester.java:34: cannot find symbol symbol : class Bundle location: class JavaTester activity.onCreate(new Bundle()); ^ ./CustomListActivity.java:15: cannot find symbol symbol : method setContentView(int) location: class CustomListActivity setContentView(R.layout.activity_custom_list); ^ ./CustomListActivity.java:17: cannot find symbol symbol : class ArrayAdapter location: class CustomListActivity ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mUrls); ^ ./CustomListActivity.java:17: cannot find symbol symbol : class ArrayAdapter location: class CustomListActivity ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mUrls); ^ ./CustomListActivity.java:17: package android.R does not exist ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, mUrls); ^ 30 errors
If I do not change anything in my code which is shown below and click Recheck Work about 3-5 times it says I'm correct.
import android.os.Bundle; import android.widget.ArrayAdapter; import android.view.View; import android.view.ListView; import android.content.Intent; import android.net.Uri;
public class CustomListActivity extends ListActivity {
protected String[] mUrls = { "http://www.teamtreehouse.com", "http://developer.android.com", "http://www.github.com" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_list);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mUrls);
setListAdapter(adapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
}
}