Android中读取assets文件夹中的子文件夹内容

时间:2022-11-10 17:09:20

文件结构如下:assets/info/info

       AssetManager am = this.getResources().getAssets();
InputStream input = null;
try {
input = am.open("info/info");
int len = input.available();
byte[] buffer = new byte[len];
input.read(buffer);
input.close();
String str = EncodingUtils.getString(buffer, "UTF-8");
Toast.makeText(this, str, Toast.LENGTH_LONG).show();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}