我想读取一个文件,并且不断收到一个错误,说ENOENT(没有这样的文件或目录)。在Android上阅读文件
我在我的电脑上创建了.txt文件,然后我想使用它。我试着把文件放在很多不同的地方,资产文件夹,数据/数据/文件,我一直在收到错误。有人能帮我吗?
这是我写的代码。
try {
FileInputStream fis = openFileInput("permissions.txt");
DataInputStream dataIO = new DataInputStream(fis);
String strLine = null;
int i =0;
while((strLine = dataIO.readUTF()) != null){
i++;
String[] temp = strLine.split(":");
if(temp[0].contains("String")){
PermissionNames.names[i] = remove(temp[0]);
}
PermissionNames.descriptions[i] = temp[1];
}
dataIO.close();
fis.close();
}catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}