【问题标题】:Android store bitmap and get bitmap from internal storageAndroid存储位图并从内部存储中获取位图
【发布时间】:2014-06-30 07:04:26
【问题描述】:
String fileName;

private void writeFile(Bitmap bmp) {
FileOutputStream out = null;
try {
       out = new FileOutputStream(name + ".jpeg");
       bmp.compress(Bitmap.CompressFormat.JPEG, 90, out);
} catch (Exception e) {
    e.printStackTrace();
} finally {
       try{
           out.close();
       } catch(Throwable ignore) {}
}
}
private void readFile() {

}

现在我需要读取文件。 请完全根据我的代码帮助编写“readFile()”方法。 提前谢谢你。

【问题讨论】:

标签: android file bitmap


【解决方案1】:

尝试以下

File f=new File(path, name + ".jpeg");
Bitmap b = BitmapFactory.decodeStream(new FileInputStream(f));

看看Saving and Reading Bitmaps/Images from Internal memory in Android

【讨论】:

  • 根据我的代码我应该这样做吗?文件 f = new File( ,fileName + ".jpeg");?我应该写什么来代替路径?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-14
  • 2012-01-07
  • 1970-01-01
  • 1970-01-01
  • 2013-03-17
  • 1970-01-01
相关资源
最近更新 更多