InputStream myInput = myContext.getAssets().open("MyFolder/" + "MyFile.db3");
我在上面的子文件夹中的 Assets 文件夹中有一个文件。但是它没有获取文件,有没有特殊的方法可以在assets文件夹中指定一个子文件夹?
伊恩
最佳答案
编辑:关于子文件夹的错误。
此代码在 1.5 上运行良好(对于放置在 assets
中 sub
文件夹下的文件 sample.txt
):
InputStream is = getAssets().open("sub/sample.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine()) != null) {
Log.e("wtf", line);
}
br.close();
你确定你的名字是对的吗?
关于带有子文件夹的 Android Assets ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3033902/