2019独角兽企业重金招聘Python工程师标准>>> 
sqlite数据库存取图片信息。
存储图片:bitmap
private byte[] getIconData(Bitmap bitmap){
int size = bitmap.getWidth()*bitmap.getHeight()*4;
ByteArrayOutputStream out = new ByteArrayOutputStream(size);
try {
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
out.close();
} catch (IOException e) {
e.printStackTrace();
}
return out.toByteArray();
}
获取图片:
Bitmap getIconFromCursor(Cursor c, int iconIndex) {
byte[] data = c.getBlob(iconIndex);
try {
return BitmapFactory.decodeByteArray(data, 0, data.length);
} catch (Exception e) {
return null;
}
}
转载于:https://my.oschina.net/yumingxinli/blog/108349
最后
以上就是傻傻芝麻最近收集整理的关于Android-sqlite数据库存取图片信息的全部内容,更多相关Android-sqlite数据库存取图片信息内容请搜索靠谱客的其他文章。
发表评论 取消回复