Reputation: 1
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db=new DBAdapter(this);
db.open();
Cursor c = db.getrecord();
c.moveToFirst();
String[][] records = new String[c.getCount()][2];
for(int i =0; i<c.getCount(); i++)
{
records[i][1]=c.getString(0);
records[i][2]=c.getString(1);
c.moveToNext();
}
ArrayAdapter<String> a = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_2,records);
setListAdapter(a);
}
i want to ask that, i want to show two record in one list like
id name
1 kashif
2 rana
Upvotes: 0
Views: 821
Reputation: 3450
Just create a Layout for the rows that consist of the two view that will display the information for each of your rows, and the on the getview method insert the necessary data to each of the views. look at this tutorial for a good head start.
Upvotes: 1