我对阅读CSV File
:
我在此函数中使用此路径:
String splitBy = ",";
BufferedReader br = new BufferedReader(new FileReader(path));
String line;
while((line = br.readLine()) != null){
String[] b = line.split(splitBy);
System.out.println(b[0]);
Log.e("Final Val",b[0]);
}
br.close();
我遇到以下异常:/file:/storage/emulated/0/Download/student.csv: open failed: ENOENT (No such file or directory)
当我将此文件添加到Android中的原始目录时,它为我提供了正确的数据。请帮我解决这类问题。
答案 0 :(得分:1)
您的应用需要访问外部存储的权限。检查你的清单
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />