android - --- SkImageDecoder::Factory returned null -


i trying insert , retrieve image data sqlite database. have following codes. image inserted correctly when try retrieve, logcat shows --- skimagedecoder::factory returned null error. please me

this class used create , insert database

    imageview img;     string picpath;     bitmap bmp;     canvas cnvs;     random r;     int x, y, height, width;     bytearrayoutputstream blob;     //sql sql;     paint paint;     string name, no;     uri data;     sqlitedatabase db;     string[] filepath = {mediastore.images.media.data};     ;     cursor cur;     textview txt;     int colindex;     contentvalues ctv;     byte[] imgdata;       public static final string db_name = "new.db";     public static final string table_name = "sample";     public static final int db_version = 1;      public static final string name = "name";     public static final string no = "no";     public static final string img = "img";     public static final string pixelx = "posx";     public static final string pixely = "posy";      public void create() {         db = openorcreatedatabase(db_name, context.mode_world_writeable, null);         db.execsql("create table if not exists " + table_name + "(" + name + " text not null," + no + " text primary key," + img + " blob," + pixelx + " integer ," + pixely + " integer );");         db.close();     }      public void insert() {         db = openorcreatedatabase(db_name, context.mode_private, null);         db.execsql("delete " + table_name);         ctv.put(name, name);         ctv.put(no, no);         try {             fileinputstream img_file = new fileinputstream(picpath);             bufferedinputstream bis = new bufferedinputstream(img_file);             imgdata = new byte[bis.available()];             bis.read();             ctv.put(img, imgdata);             long val = db.insert(table_name, null, ctv);             toast.maketext(this.getbasecontext(), "image saved", toast.length_short).show();             if (val < 0)                 toast.maketext(this.getbasecontext(), "image not saved", toast.length_short).show();             bis.close();         }         catch (exception e) {             e.getmessage();         }         db.close();     }       protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.register);           ctv = new contentvalues();         img = (imageview) findviewbyid(r.id.imageview1);          r = new random();         paint = new paint();         x = r.nextint(100);         blob = new bytearrayoutputstream();         create();          intent = getintent();         name = i.getstringextra("name");         no = i.getstringextra("no");         //open button         button open = (button) findviewbyid(r.id.button3);         open.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                 // todo auto-generated method stub                 intent gal_open = new intent(intent.action_pick, android.provider.mediastore.images.media.external_content_uri);                 startactivityforresult(gal_open, 1);              }         });         txt = (textview) findviewbyid(r.id.textview1);          button shuffle = (button) findviewbyid(r.id.button2);         shuffle.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                 // todo auto-generated method stub                  bmp = bitmap.createbitmap(img.getheight(), img.getwidth(), bitmap.config.rgb_565);                 cnvs = new canvas(bmp);                  height = img.getmeasuredheight();                 width = img.getmeasuredwidth();                 x = r.nextint(height);                 y = r.nextint(width);                 paint.setcolor(color.red);                   txt.settext(x + "," + y);                 cnvs.drawbitmap(bitmapfactory.decodefile(picpath), 0, 0, null);                 cnvs.drawrect(x, y, x + 20, y + 20, paint);                 img.setimagebitmap(bmp);              }         });           button ok = (button) findviewbyid(r.id.button1);         txt = (textview) findviewbyid(r.id.textview1);          ok.setonclicklistener(new view.onclicklistener() {              @override             public void onclick(view v) {                 // todo auto-generated method stub                 create();                 insert();                  startactivity(new intent(getapplicationcontext(), mainactivity.class));             }         });     }       public void onactivityresult(int requestcode, int resultcode, intent intentdata) {         super.onactivityresult(requestcode, resultcode, intentdata);         if (requestcode == 1 && resultcode == result_ok && intentdata != null) {              bmp = bitmap.createbitmap(img.getheight(), img.getwidth(), bitmap.config.rgb_565);             cnvs = new canvas(bmp);             height = img.getmeasuredheight();             width = img.getmeasuredwidth();             x = r.nextint(height);             y = r.nextint(width);             paint.setcolor(color.red);              data = intentdata.getdata();              cur = getcontentresolver().query(data, filepath, null, null, null);             cur.movetofirst();              colindex = cur.getcolumnindex(filepath[0]);             picpath = cur.getstring(colindex);             cur.close();              txt = (textview) findviewbyid(r.id.textview1);             txt.settext(x + "," + y);             cnvs.drawbitmap(bitmapfactory.decodefile(picpath), 0, 0, null);             cnvs.drawrect(x, y, x + 20, y + 20, paint);             img.setimagebitmap(bmp);         }     } 

the code retrieve data is

public class login extends activity {     //sql sql;     user user;     string name;     textview no;     imageview img;     int imgx, imgy;     view touchlistener;     sqlitedatabase db;     byte[] imgdata1;     cursor cur;     int pixelx, pixely;     public static final string db_name = "new.db";     public static final string table_name = "sample";     public static final int db_version = 1;      public static final string name = "name";     public static final string no = "no";     public static final string img = "img";     public static final string pixelx = "posx";     public static final string pixely = "posy";      @suppresslint("newapi")     public void retrieve() {         img = (imageview) findviewbyid(r.id.imageview1);          db = openorcreatedatabase(db_name, context.mode_world_writeable, null);         cur = db.query(true, table_name, new string[]{name, no, img, pixelx, pixely}, null, null, null, null, null, null, null);         cur.movetofirst();         imgdata1 = cur.getblob(cur.getcolumnindex("img"));         img.setimagebitmap(bitmapfactory.decodebytearray(imgdata1, 0, imgdata1.length));         toast.maketext(getapplicationcontext(), "image retreived", 100).show();         cur.close();         db.close();     }      public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.login);         retrieve();     } } 


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -