6
如何将图像存储为Sqlite中的Blob和如何检索它?
我想将图像(来自URL)存储到sqlite数据库中。 为此,我使用: db = new DataBase(getApplicationContext()); URL url = new URL("http://sree.cc/wp-content/uploads/schogini_team.png"); URLConnection ucon = url.openConnection(); InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is,128); ByteArrayBuffer barb= new ByteArrayBuffer(128); int current = 0; while ((current = bis.read()) != -1) { barb.append((byte) current); } ContentValues filedata= new ContentValues(); filedata.put(DataBase.IMG_SRC,barb.toByteArray()); db.insert(DataBase.Table_Img, null, filedata); …