android - Retrieve blob from sqlite -
i retrieve blob database base on row position
i'm retrieving data sqlite database using cursor
public cursor gettestdata(int index,string house) { try { string sql ="select * heroes position ="+ index +" , house='"+house+"'"; cursor mcur = mdb.rawquery(sql, null); if (mcur!=null) { mcur.movetofirst(); } return mcur; } catch (sqlexception msqlexception) { log.e(tag, "gettestdata >>"+ msqlexception.tostring()); throw msqlexception; } }
this returns me columns , can strings
cursor testdata = mdbhelper.gettestdata(pos,house); string sname = utility.getcolumnvalue(testdata, "name"); string sadvance = utility.getcolumnvalue(testdata, "class");
this return column "name" , "class" value, how retrieve blob , show it.
byte[] img = utility.getimage(testdata, "image1");
this how im trying
public static byte[] getimage(cursor cur,string columnname){ return cur.getblob(cur.getcolumnindex(columnname)); }
but getting null in img :(
Comments
Post a Comment