I use SimpleAdapter to display 2 strings, one on the left and the other on the right, into a ListView,
The strings are in 2 different arrays. and 1st from array A with 1st in array B are in the 1st line, and so on..
Here is a part of the code I use:
String[] array= getResources().getStringArray(R.array.Names_List);
int lengthtmp= array.length;
for(int i=0;i<lengthtmp;i++)
{
counter++;
AddToList(array[i]);
}
adapter = new SimpleAdapter(this,list,R.layout.start_row,new String[] {"number","suraname"},new int[] {R.id.Start_Numbering,R.id.Start_Name});
private void AddToList(String name) {
HashMap<String,String> temp = new HashMap<String,String>();
temp.put("number", Integer.toString(SortingPictures[counter-1]));
temp.put("suraname", name);
list.add(temp);
}
I'm sure there is a better way to make what I want. What's the correct way?
No it is not a proper way to implementing this here i am given a link for you read id and get idea for implementing it.
http://www.heikkitoivonen.net/blog/2009/02/15/multicolumn-listview-in-android/