zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

Android之asset文件夹下文件的使用

Android文件 文件夹 使用 Asset
2023-09-27 14:25:13 时间

1. 获取AssetManager

   AssetManager am = context.getAssets();


2. 列出assets文件夹下全部文件

  String[] filePathList = am.list("");


3. 打开某个文件

InputStream is = am.open("test.txt");


4. 获取到InputStream后,就能够通过IO库进行文件操作了。或者通过BitmapFactory.decodeStream(is)得到Bitmap对象