Android Java Code : Convert column values in to rows? -
i have table value in sqlite like..
101 local local local local local local 102 9 12 9 12 9 9 1 3:55 4:20 4:40 5:00 5:20 5:40 18 4:50 5:15 5:35 5:55 6:15 6:35
above value need store in
arraylist> listdata = new arraylist>(); or other arrays
local 9 3:55 4:50 local 12 4:20 5:15 local 9 4:40 5:35 local 12 5:00 5:55 local 9 5:20 6:15 local 9 5:40 6:35
plz me find :)
i think best way create domain/container-object table entitys.
public class tableentity { private int col1; private string col2; private string col3; // generate getters , setters... }
then reading values of sqlite table create new object , return arraylist:
arraylist<tableentity> lalltableentitys = new arraylist<tableentity>(); while(cursor.movetonext()){ tableentity tableentity = new tableentity(); tableentity.setcol1(cursor.getstring(cursor.getcolumnindex("col1"))); tableentity.setcol2(cursor.getstring(cursor.getcolumnindex("col2"))); tableentity.setcol3(cursor.getstring(cursor.getcolumnindex("col3"))); lalltableentitys.add(tableentity); } return lalltableentitys;
after can read with
tableentity.getcol1(); tableentity.getcol2(); tableentity.getcol3();
Comments
Post a Comment