마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

CustomAdapter를 적용해서 변수를 넘기면 여러번 찍히는 이유가

0 추천
CustomAdapter를 만들어서 getView에서 값을 확인하는데요

ArrayList에 HashMap을 담아서 보내는데

값들이 여러번 찍히는 이유는 무엇일까요?

// json 값은 총 길이가 3개 입니다.
for (int i = 0; i < android.length(); i++) {
 JSONObject c = android.getJSONObject(i);
 String name = c.getString("name");
 HashMap<String, String> map = new HashMap<String, String>();
 map.put("name", name);
 oslist.add(map);
 list = (ListView) findViewById(R.id.list0);
 adapter = new CustomAdapter(TestActivity.this,oslist, R.layout.list_test, new String[] { "name" }, new int[] {R.id.name});
 list.setAdapter(adapter);
}

[CustomAdapter]
HashMap<String, Object> data = (HashMap<String, Object>) getItem(position);
String name = (String)data.get("name");
Log.e("CustomAdapter", position + " : " + name);

여기서 로그가 3개 찍혀야 하는데 총 15번정도 찍히는 이유를 모르겠어요
좀 도와주세요 ㅠㅜ
초봉초봉 (3,480 포인트) 님이 2014년 11월 25일 질문

1개의 답변

0 추천
HashMap<String, Object> data = (HashMap<String, Object>) getItem(position);
String name = (String)data.get("name");
Log.e("CustomAdapter", position + " : " + name);

위부분이 어디에 들어있나요?
익명사용자 님이 2014년 11월 25일 답변
CustomAdapter 에 들어있어요
...