且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法打开存储在SD卡图像文件

更新时间:2023-09-28 09:40:10

字符串连接不是路径结合起来的好方法。这是更好地使用文件构造

String concatenation isn't a good way to combine paths. It is better to use the File constructor :

File directory = new File(extStorageDirectory, "myFolder");
File fileInDirectory = new File(directory, files[which]);
Bitmap bitmap = BitmapFactory.decodeFile(fileInDirectory.getAbsolutePath());