[英]java.io.FileNotFoundException: [filepath] (No such file or directory)
I'm trying to read from a file but i'm getting false on the check. 我正在尝试从文件中读取内容,但支票上的内容却是虚假的。 I can't see why this is happning, The file exist i have a multible time just to be sure. 我不明白为什么会这样,文件存在,我有很多时间可以确定。
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
I also have included this in the AndroidManifest.xml file so that is not the problem either. 我还将其包含在AndroidManifest.xml文件中,因此也不是问题。
String filePath = Environment.getExternalStorageDirectory() + "/folder/Save.spm";
File filecheck = new File(filePath);
if(filecheck.exists() == false)
{
return false;
}
FileInputStream file = new FileInputStream(filePath);
DataInputStream input = new DataInputStream(file);
Why does android claim that the file does not exist? 为什么Android声称该文件不存在?
How did you check that the file exists ? 您如何检查文件是否存在? Have your tried using the ADB pull command to retrieve the file back from the emulator (if you are using one) ? 您是否尝试过使用ADB pull命令从仿真器中取回文件(如果使用的是)?
adb pull /path/to/file
Get the absolute path for filecheck and try that. 获取文件检查的绝对路径,然后尝试尝试。 It is also possible that you are mistaking the application cache directory with the external storage. 您还可能将应用程序缓存目录与外部存储区混淆。 Or may be there is more than one external storage and you are looking at the wrong one. 或者可能有多个外部存储,而您正在寻找错误的外部存储。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.