【发布时间】:2018-02-05 02:41:53
【问题描述】:
使用下面的代码,我试图访问存储在asset/raw 文件夹中的文件,但得到null 和
E/ERR: file:/android_asset/raw/default_book.txt (No such file or directory)
错误,我的代码是:
private void implementingDefaultBook() {
String filePath = Uri.parse("file:///android_asset/raw/default_book.txt").toString();
File file = new File(filePath);
try {
FileInputStream stream = new FileInputStream(file);
} catch (Exception e) {
e.printStackTrace();
Log.e("ERR ", e.getMessage());
} catch (OutOfMemoryError e) {
e.printStackTrace();
}
}
【问题讨论】: