Вместо ArrayAdapter попробуйте использовать SimpleAdapter.
ArrayList<HashMap<String, String>> sampleArrayList;
SimpleAdapter sampleListAdapter;
HashMap<String, String> sampleObjectMap;
for (SampleObject sampleObj : sampleList) {
sampleObjectMap= new HashMap<String, String>();
sampleObjectMap.put("value1", sampleObj.getValue1());
sampleObjectMap.put("value2", sampleObj.getValue2());
sampleObjectMap.put("value3", sampleObj.getValue3());
sampleObjectMap.put("value4", sampleObj.getValue4());
sampleArrayList.add(sampleObjectMap);
}
sampleListAdapter= new SimpleAdapter(
context, sampleArrayList,
R.layout.custom_list_layout, new String[] {
"value1", "value2" , "value3", "value4"},
new int[] { R.id.list_content_column1,
R.id.list_content_column2,
R.id.list_content_column3,
R.id.list_content_column4});
sampleListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
HashMap<String, String> sampleObjectMapLocal = sampleArrayList
.get(position);
final String value1Obj = sampleObjectMapLocal .get("value1");
System.out.println("value1Obj : " + value1Obj);
}
});
В приведенном выше коде содержимое listView заполняется с использованием ArrayList sampleArrayList
и поэтому к элементам в любом столбце можно получить доступ с помощью ключа («значение1», «значение2», «значение3», «значение4»).
Надеюсь, это поможет.