存储图像到SQLite的Android中 [英] storing image into SQLite in android
问题描述
海所有我想要存储在SQLite的图像database.that从SD卡中选择。
在搜索在谷歌I发现,BLOB是存储图像数据库的方式。
这<一href="http://stackoverflow.com/questions/6028751/how-to-display-image-from-blob-data-in-android-sqlite">link随后插入,但它不为我工作, 如何将图像转换成二进制大对象?
我怎样才能在数据库中存储的图像在BLOB格式?
谁能给我样品存储图像数据库?
请帮我....
位图图像= BitmapFactory.de codeResource(getResources(),R.drawable.thumbnail);
ByteArrayOutputStream OUT =新ByteArrayOutputStream();
image.com preSS(Bitmap.Com pressFormat.PNG,100,出);
ContentValues CV =新ContentValues();
cv.put(KEY_IMAGE,out.toByteArray());
db.insert(DB_TABLE,空,CV);
一个完整的示例的http://www.anddev.org/png_image_--und-gt_sqlite_db_--und-gt_imageview-t7188.html
hai all i want to store an image in SQLite database.that was selected from SD card.
After searching in the google i found that BLOB is the way to store image in database.
this link followed to insert but it does not work for me, how to convert a image into blob?
how can i store image in the database in blob format?
can anyone give me the sample to store the image in database?
Please help me....
Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.thumbnail);
ByteArrayOutputStream out = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.PNG, 100, out);
ContentValues cv = new ContentValues();
cv.put(KEY_IMAGE, out.toByteArray());
db.insert(DB_TABLE, null, cv);
A full example http://www.anddev.org/png_image_--und-gt_sqlite_db_--und-gt_imageview-t7188.html
这篇关于存储图像到SQLite的Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!