android 遍历assets下的文件

AssetManager中有个list()方法,传入你的子文件名称即可:

  1. String[]  flLists=this.getAssets().list("your_subdir");

如果是根目录,那么就是这么写:

   
  1. AssetManager assetManager = getAssets();
  2.     String[] files =null;
  3.     try{
  4.         files = assetManager.list("");
  5.     }catch(IOException e){
  6.         Log.e("tag", e.getMessage());
  7.     }

猜你喜欢

转载自bgj.iteye.com/blog/1990226