【发布时间】:2011-08-05 01:41:51
【问题描述】:
如何将来自互联网的多个图像存储在 sdcard 中并将路径存储在数据库中?对于多张图片,我该怎么办?到目前为止,我所做的是..
表创建查询如下:
"create table table1 (_id integer primary key autoincrement, "
+ "title text not null, definition text not null, image BLOB not null);";
但是为了存储我插入的一个值
bmOptions = new BitmapFactory.Options();
bmOptions.inSampleSize = 1;
bm = Loadmage(image_URL, bmOptions);
mImageV.setImageBitmap(bm);
extStorageDirectory = Environment.getExternalStorageDirectory().toString();
OutputStream outStream = null;
File file = new File(extStorageDirectory, "er.PNG");
try{
outStream = new FileOutputStream(file);
bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.flush();
outStream.close();
}catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
所以对于所有标题显示相同的图像...我想为不同的标题显示不同的图像..
【问题讨论】:
-
在数据库中为每条记录存储一个路径有问题吗?也许您需要问题中的更多细节,例如您的数据库表是什么样的。