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

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

Clement Chai
Clement Chai
4,085 Points

I don't understand this challenge, the HashMap can only take in 2 parameters but seems like the challenge requires 4

I couldn't get through this challenge please help.

WebsiteListActivity.java
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 };


    }
}

1 Answer

Clement Chai
Clement Chai
4,085 Points

Ok nevermind i got it

site1.put(KEY_NAME, "name1"); site1.put(KEY_URL, "http://google.com"); site2.put(KEY_NAME, "name2"); site2.put(KEY_URL, "http://google.com");