ArrayList<HashMap<Contact, Name>>
이 있는데 ListView
을 채 웁니다. 당신은 내가 모든 노력을했지만 난 여전히 작동 만들 수 없습니다ArrayList에서 ListView 채우기 <HashMap <String, String >>
The constructor ArrayAdapter<String>(Context, int, ArrayList<HashMap<String,String>>) is undefined
수 : 여기 마지막 줄에 이클립스에서 오류를 던지고있다 그건 (작동하지 않는) 내 시도
ArrayList<HashMap<String, String>> lista = new ArrayList<HashMap<String, String>>();
// Array of strings "titulos"
String titulos[] = { "Dolar (Transferencia)", "Euro (Transferencia)",
"Dolar (Efectivo)", "Euro (Efectivo)", "Dolar (cúcuta)",
"Euro (cucuta)" };
try {
JSONObject json = result; // result is a JSONObject and the source is located here: https://dl.dropbox.com/u/8102604/dolar.json
JSONObject root = json.getJSONObject("root");
JSONArray items = root.getJSONArray("item");
int j = 0;
for (int i = 0; i < items.length(); i++) {
JSONObject item = items.getJSONObject(i);
String key = item.getString("key");
String mount = item.getString("mount");
if (key.equals("TS") || key.equals("TE") || key.equals("EE")
|| key.equals("CE") || key.equals("ES")
|| key.equals("CS")) { // i did this since i only need the items where the key is equal to TS, TE, EE, CE, ES or CS.
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", String.valueOf(i));
map.put(key, mount);
lista.add(map);
System.out.println(titulos[j] + "(" + key + "). BsF = " + mount); // just for debugging purposes
j++; // add 1 to j if key is equal to TS, TE, EE, CE, ES or CS. In this way i can associate the two arrays (item and titulos)
}
}
ListView lv = (ListView) myMainActivity.findViewById(R.id.listView1); // create a list view
lv.setAdapter(new ArrayAdapter<String>(contexto, android.R.layout.simple_list_item_1, lista)); // set adapter to the listview (not working)
} catch (JSONException e) {
Log.e("log_tag", "Error parsing data " + e.toString());
}
}
있어 도와주세요, 제발?
미리 감사드립니다.
PS : 전체 소스 : https://gist.github.com/4451519
ArrayAdapter와, 당신이있어 :
나는
다음
from
및to
에 의해 단순히 대체 할 것이다 그것을 HashMaps의리스트로 제공한다. 그것과 생성자에게 전달 –hashmap의 목록도 SimpleAdapter – njzk2
함께 간다, 오류는 이클립스에서 해당 javac에서 아닙니다. – njzk2