android - Getting SQLite database and storing it in an array of objects -
i'm looking @ notes app example android sdk. want learn how instead of using cursoradapter pass listadpater/listview sort out, want know how can deal data myself; particularly in arraylist form. in example, note has id, title, , body. want know how can query sqlite database , use cursor returns collect data , create object instances of object i'll call note has parameters id, title, , body. want store these objects arraylist management. i'm not sure how deal cursor. pretty general question need point me in right direction.
i might not question need query db add cursor data arraylist?
list<string> pointslist = new arraylist<string>(); database = openorcreatedatabase("favorites", sqlitedatabase.open_readwrite, null); if(database!=null) { c= database.rawquery(query, null); c.movetofirst(); while(c.isafterlast()==false) { pointslist.add(c.getint(c.getcolumnindex("id")); // same other columns c.movetonext(); } } database.close(); c.close();
Comments
Post a Comment