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!
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

Chris Collins
2,490 PointsAdding Secondary Data with a SimpleAdapter Code Challenge part 1
import android.os.Bundle;
import android.widget.SimpleAdapter;
public class WebsiteListActivity extends ListActivity {
public static final String KEY_NAME = "name";
public static final String KEY_URL = "url";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_website_list);
String[] keys = { KEY_NAME, KEY_URL };
int[] ids = { android.R.id.text1, android.R.id.text2 };
HashMap<String, String> name = new HashMap<String, String>();
name.put(KEY_NAME, value);
name.put(KEY_URL, value);
HashMap<String, String> url = new HashMap<String, String>();
url.put(KEY_NAME, value);
url.put(KEY_URL, value);
}
}
hi
this is what i have done in the first part of the code challenge, i cant really see what i am doing wrong, can anyone point me in the right direction
thank
chris
2 Answers

Ernest Grzybowski
Treehouse Project ReviewerTry adding some String values to where you have written value
.
Something like this will pass the code challenge:
HashMap<String, String> name = new HashMap<String, String>();
name.put(KEY_NAME, "One");
name.put(KEY_URL, "Two");
HashMap<String, String> url = new HashMap<String, String>();
url.put(KEY_NAME, "Three");
url.put(KEY_URL, "Four");

Steven Williams
7,333 PointsChanging the "value" to KEY_URL as the second parameter of the put methods will pass the challenge as well.
HashMap<String, String> name = new HashMap<String, String>();
name.put(KEY_NAME, KEY_URL);
name.put(KEY_URL, KEY_URL);
HashMap<String, String> url = new HashMap<String, String>();
url.put(KEY_NAME, KEY_URL);
url.put(KEY_URL, KEY_URL);