sample values are colomn1, colomn2. After fetching values I should display them row by row. Please help me here.
public ArrayList<String> getAllData(){
ArrayList<String> array_list = new ArrayList<String>();
//hp=new HashMap();
SQLiteDatabase db=this.getReadableDatabase();
Cursor res=db.rawQuery("select * from spendlist", null);
res.moveToFirst();
if (res != null && res.moveToFirst() ){
while (!res.isAfterLast()) {
array_list.add(res.getString(res.getColumnIndex(SPEND_LIST_COLUMN_DESC)));
res.moveToNext();
}
}
return array_list;
}
above code i am using to fetch data to populate it i am using
ArrayList array_list = mydb.getAllData();
ArrayAdapter arrayAdapter=new ArrayAdapter(this,android.R.layout.simple_list_item_1, array_list);
obj = (ListView)findViewById(R.id.listView1);
obj.setAdapter(arrayAdapter);
Now I want to fetch all data instead one column and populate it