0

I have worked in Listview, I have stored values in arraylist1 and arraylist2, then retrieve the value from arraylist1, arraylist2 and then insert these two arraylists values in each row, how? Please can any one help me?

Thanks

Example:

arraylist1 - 23/1/12
arraylist2 - welcome

These two values are inser in Listview

ListView - 23/1/12     welcome
Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
Sampath Kumar
  • 1,650
  • 4
  • 14
  • 16
  • http://stackoverflow.com/questions/6383330/how-to-combine-two-array-list-and-show-in-a-listview-in-android ? – quux Jan 24 '12 at 06:27

1 Answers1

4

You can use Multicolumn ListView in Android. And add your arraylists values in

ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
map.put("Value1", arrayList1.get(0));
map.put("Value2", arrayList2.get(0));
mylist.add(map);
user370305
  • 108,599
  • 23
  • 164
  • 151
  • lv1.setAdapter(new ArrayAdapter(DocketCalc.this,android.R.layout.simple_list_item_1 , mylist)); – Sampath Kumar Jan 24 '12 at 06:49
  • Yes, because, you need a give a resource id, which display those strings, If possible use the same adapter as provided in example link. – user370305 Jan 24 '12 at 06:52