android - GridView with images from DataBase -
i have images in db , put gridview code:
public void setnotes() { string[] columns = {notesdbadapt.key_id, notesdbadapt.key_img, notesdbadapt.key_name, notesdbadapt.key_date, notesdbadapt.key_time}; string table = notesdbadapt.notes_table; cursor c = mainnote.mdb.gethandle().query(table, columns, null, null, null, null, null); startmanagingcursor(c); simplecursoradapter adapter = new simplecursoradapter(this, r.layout.file_dialog_row, c, new string[] {notesdbadapt.key_img, notesdbadapt.key_name, notesdbadapt.key_date, notesdbadapt.key_time}, new int[] {r.id.img, r.id.txt, r.id.date, r.id.time}); adapter.setviewbinder(new notesbinder()); gridview.setadapter(adapter); }
all ok, but scrolling slow, jerky. seems information takes db every time. how fix it?
this method deprecated in api level 11. use new cursorloader class loadermanager instead. can perform cursor query on background thread not block application's ui.
Comments
Post a Comment