我试图让存储在我的资产文件夹txt文件名称的列表,但是当我打电话获得从资产txt文件名文件夹到一个列表
String[] files = assetManager.list("/assets");
我得到一个例外
01-13 15:48:44.819: E/AndroidRuntime(6754): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.readd/com.example.readd.MainActivity}:
我想我有错,在列表(“/资产”)。参数“/资产”,但不要有想法如何解决这个问题。
编辑在我的资产文件夹中,我得到只是原始文件,无需子
text1.txt
text2.txt
text3.txt
我也尝试assetManager。列表( “”);但是当我尝试设置txtView的名称(可以说)第一个文件tt.setText(文件[0]),它给我的图像作为结果,我没有这样的文件在我的资产
EDIT2
AssetManager assetManager = getApplicationContext().getAssets();
try {
String[] files = assetManager.list("");
InputStream stream = getAssets().open("text1.txt");
tt.setText(files[0]);//here i get images(as String not real images) as result
}
完整堆栈跟踪。 – njzk2
什么样的图片? – njzk2
就像字符串...“images” – Android