Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Grant Hosticka
Grant Hosticka
4,172 Points

Need Help

See Code Below:

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

      // What I added
        HashMap<String, String> one = new HashMap<String, String>();
        HashMap<String, String> two = new HashMap<String, String>();
        one.put(KEY_NAME, KEY_URL);
        two.put(KEY_NAME, KEY_URL):


    }
}

2 Answers

Just looked at the question. It is kinda poorly worded.... What it means is that it wants two hash maps, and in both of them, it wants something like this:

KEY_NAME => "Treehouse"

KEY_URL => "http://www.teamtreehouse.com/"

What you put in as the name and the url do not matter.

Once you've done that for one, just do the exact same thing for two. You should have 6 lines of coded added.