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

Android Build a Blog Reader Android App Adapting Data for Display in a List Adding Secondary Data with a SimpleAdapter

"error while writing android.widget.SimpleAdapter"

I am getting an error "while writing android.widget.SimpleAdapter".. on adapting-data-for-display-in-a-list challenge task 1.

this is my code:

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

public void onCreate(Bundle savedInstanceState) {

    String[] keys = { KEY_NAME, KEY_URL };
    int[] ids = { android.R.id.text1, android.R.id.text2 };

  HashMap <String, String> map = new HashMap<String, String>();
  map.put(KEY_NAME, "treehouse");
  map.put(KEY_URL, "http://teamtreehouse.com/home");
  HashMap <String, String> map2 = new HashMap<String, String>(); 
  map2.put(KEY_NAME, "treehouse");
  map2.put(KEY_URL, "http://teamtreehouse.com/home"); 


1 Answer

Evelina Yankova
Evelina Yankova
5,869 Points

Hi, the challenge says you should name your varaibles site1 and site2. Just replace map and map2 with site1 and site2 and it should work