我正在尝试将位图保存到Pictures目录中.这是代码
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 /.
谢谢!
最佳答案
原文链接:https://www.f2er.com/android/430678.html