File file = new File("file:///storage/sdcard0/myfile.txt");
if (file.exists()) {
//...
}
ファイルは SD カードにあるのに、file.exists() が常に false を返すのはなぜですか?
File file = new File("file:///storage/sdcard0/myfile.txt");
if (file.exists()) {
//...
}
ファイルは SD カードにあるのに、file.exists() が常に false を返すのはなぜですか?
なしで試すfile://
File file = new File("/storage/sdcard0/myfile.txt");
if (file.exists()) {
//...
}
これで試してみてください-
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/myfile.txt");
if (file.exists()) {
//...
}