0
我有一个非常简单的问题,但我只想弄明白。从哈希映射中获取字符串
我希望能够从一个HashMap中拿出一些东西,但不能让它工作。
下面是代码:
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);
我在得到一个compiller错误(mylist.get( “图片”));
' “图片报”'是在'map',而不是在'mylist',我想。 – nullpotent 2012-07-31 09:12:53
不应该是map.get(“picture”)或((HashMap)mylist.get(0))。get(“picture”) – krishnakumarp 2012-07-31 09:13:24
错误是什么? – sunil 2012-07-31 09:13:52