Android的资产,子文件夹 [英] Android Assets with sub folders

查看:165
本文介绍了Android的资产,子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

InputStream myInput = myContext.getAssets().open("MyFolder/" + "MyFile.db3");

我的资产文件夹上面的文件在子文件夹中。它没有得到该文件虽然是有一个特殊的方式来指定一个子文件夹中的文件夹中的资产?

I have a file in the assets folder in a sub folder as above. It doesn't get the file though, is there a special way to specify a sub folder in the assets folder?

伊恩

推荐答案

编辑:看错了子
。 这code工作得很好,在1.5(一个文件 sample.txt的在<$下文件夹放在C $ C>资产):

was wrong about subfolders.
This code works just fine on 1.5 (for a file sample.txt placed under sub folder in assets):

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();

你确定你有名字吧?

Are you sure you've got the names right?

这篇关于Android的资产,子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆