在这种情况下如何从存储卡中检索图像

时间:2012-03-30 08:47:55

标签: android-canvas android-sdcard android-file

我通过将位图传递给savephoto(位图功能)来保存图像 现在我想要检索保存的照片,如何做到这一点我是android的新手,plz给我回溯代码并将其转换为Bitmap

public void savePhoto(Bitmap b2)
{
File imageFileFolder = new File(Environment.getExternalStorageDirectory(),"Rotate");
mageFileFolder.mkdir();
FileOutputStream out = null;
Calendar c = Calendar.getInstance();
String date = fromInt(c.get(Calendar.MONTH))
+ fromInt(c.get(Calendar.DAY_OF_MONTH))
+ fromInt(c.get(Calendar.YEAR))
+ fromInt(c.get(Calendar.HOUR_OF_DAY))
+ fromInt(c.get(Calendar.MINUTE))
+ fromInt(c.get(Calendar.SECOND));
File  imageFileName = new File(imageFileFolder, date.toString() + ".jpg");
try
{
out = new FileOutputStream(imageFileName);
b2.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
out = null;
} catch (Exception e)
{
e.printStackTrace();
}

thanx帮助:)

0 个答案:

没有答案