我想检查 android SD 卡中是否存在给定的文件。我正在尝试使用绝对路径创建文件并检查file.exists()
但它不起作用。该文件的 URL 是"file:///mnt/sdcard/book1/page2.html"
并且该文件确实存在。但不知何故file.exists()
没有显示相同的内容。
File extStore = Environment.getExternalStorageDirectory();
File myFile = new File(extStore.getAbsolutePath() + "/book1/page2.html");
if(myFile.exists()){
...
}
这应该有效。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)