gpt4 book ai didi

安卓新文件(路径)

转载 作者:太空狗 更新时间:2023-10-29 15:38:29 30 4
gpt4 key购买 nike

为什么 f 不是一个文件?什么可能导致这种情况?

    String currentPhotoPath = "file:/storage/sdcard0/Pictures/someFileName.jpg";

...

File f = new File(currentPhotoPath);
if (f == null || !f.isFile()) {
// This gets executed
}

最佳答案

你试过吗?

String filePath = Environment.getExternalStorageDirectory().toString() + "/Pictures";
String fileName = "someFileName.jpg";

File f = new File(filePath,filename);

关于安卓新文件(路径),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21842588/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com