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

后端 未结 6 2035
心在旅途
心在旅途 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 03:09

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

    There are no files in res/raw/ on the device. Those are resources. There is no good way to iterate over resources, other than by using reflection to iterate over the static data members of the R.raw class to get the various ID names and values.

    but doesn't really help me find out where the raw folder exists.

    As a folder, it only exists on your development machine. It is not a folder on the device.

提交回复
热议问题