Android, how do can I get a list of all files in a folder?

后端 未结 6 2031
心在旅途
心在旅途 2020-11-30 02:28

I need the name (String) of all files in res/raw/

I tried:

File f = new File(\"/\"); 
String[] someFiles = f.list();

It looks like

6条回答
  •  情深已故
    2020-11-30 02:57

    You can use AssetManager:

    As far as I can remember, you will have list with (just try different paths):

    final String[] allFilesInPackage = getContext().getResources().getAssets().list("");
    

提交回复
热议问题