List assets in a subdirectory using AssetManager.list

后端 未结 9 636
梦谈多话
梦谈多话 2020-12-04 23:37

My application has an assets directory in which I\'ve dumped a bunch of text files I need to load at runtime.

I have a directory full of assets of a particular type

9条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-05 00:07

    I ve use the following code to list the file name in assets/myFolder/:

    String[] fileNames =getAssets().list("myFolder");
    for(String name:fileNames){
         System.out.println(name);    
    }
    

    note that the parameter in the method list does not contains "/".

提交回复
热议问题