Reputation: 537
I have a really simple problem I think but just cant figure it out.
I want to be able to take someting out of a Hashmap but just cant get it to work.
Here is the code:
try{
JSONArray deelnemers = json.getJSONArray("deelnemers");
int Key = getIntent().getIntExtra("Key", -1);
{ HashMap<String, String> map = new HashMap<String, String>();
JSONObject e = deelnemers.getJSONObject(Key);
map.put("id", String.valueOf(Key));
map.put("name", "Naam: " + e.getString("naamingw2"));
map.put("sex", "Geslacht: " + e.getString("geslacht"));
map.put("rank", "Rang: " + e.getString("rang"));
map.put("picture", "http://www.de-saksen.nl/2/images/comprofiler/" + e.getString("avatar"));
mylist.add(map);
}
String URL = new String (mylist.get("picture"));
WebView WV = (WebView) findViewById(R.id.webView1);
WV.loadUrl(URL);
I get an compiller error at (mylist.get("picture"));
Upvotes: 0
Views: 110
Reputation: 851
I could be missing something but the name of your HashMap is "map", not "mylist".
Edit: If mylist represents a list containing your HashMap, then you can do the following:
mylist.get(0).get("picture");
Upvotes: 1