how to save bytes data in a csv file and insert it in android sqlite blob field -
i have image save blob in sqlite database,now want image blob data saved on file , need insert blob data file database.i want done pragmatically done using android.any ideas how it?don't tell me show research have done.i'm new android programming , trying learn.so please me.
omg not duplicate question.the question how fetch blob data database , save in seperate file(may b csv file) , insert bytes data file sqlite db.
try { c = db.rawquery("select * " + table_name_user_profile, null); int rowcount = 0; int colcount = 0; file sdcarddir = environment.getexternalstoragedirectory(); string filename = "userprofile.csv"; // name of file export file savefile = new file(sdcarddir, filename); filewriter fw = new filewriter(savefile); bufferedwriter bw = new bufferedwriter(fw); rowcount = c.getcount(); colcount = c.getcolumncount(); if (rowcount > 0) { c.movetofirst(); (int = 0; < colcount; i++) { if (i != colcount - 1) { bw.write(c.getcolumnname(i) + ","); } else { bw.write(c.getcolumnname(i)); } } bw.newline(); (int = 0; < rowcount; i++) { c.movetoposition(i); (int j = 0; j < colcount; j++) { if (j != 7) { if (j != colcount - 1) bw.write(c.getstring(j) + ","); else bw.write(c.getstring(j)); } else bw.write((c.getblob(7)) + ","); } bw.newline(); } bw.flush(); log.e("tag", "exported successfully."); log.e("tag", "exported to" + sdcarddir); } c.close(); } catch (exception ex) { log.e("catch", ex.getmessage().tostring()); }
Comments
Post a Comment