【发布时间】:2012-09-24 12:16:22
【问题描述】:
我正在尝试将位图保存到图片目录中。这是代码
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File file = new File(path, "test1.PNG");
try {
path.mkdirs();
OutputStream out = new FileOutputStream(file);
mBitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
Log.w("ExternalStorage", "Error writing " + file, e);
}
但是执行卡在OutputStream out = new FileOutputStream(file);
我使用了调试器,完整路径返回mnt/sdcard/Pictures/test1.PNG,mnt/ 是我无法通过OutputStream out = new FileOutputStream(file); 的罪魁祸首吗?因为在我的文件目录中只能看到sdcard/。
谢谢!
【问题讨论】:
-
'path'的值是什么..??
标签: android android-image android-file