0

I have added a bunch of wave files into my assets directory for loading.

I created assets by right clicking on my res folder in android and going "Add folder -> Assets folder"

It created an assets folder at app\src\main\assets.

I have dragged a bunch of wav files into that assets directory.

But when I go to list all the files in my assets directory, it just lists a single directory called "images".

Observe the following code. There is a message write that only write out "images".

    AssetManager assets = LocalApp.getAppContext().getAssets();
    String[] fileList = assets.list("");

    // we assume all the files in the assets are the wav files that we want to load,
    // so attempt to load everythign in assets as a wav
    for (int i = 0; i < fileList.length; i++) {
        Log.e(TAG, "readSamples: file name = "+fileList[i]);
        WavFile wave =  new WavFile(assets.open(fileList[i]));
        samples.add(wave);
    }
Scorb
  • 1,654
  • 13
  • 70
  • 144

1 Answers1

-1

Maybe you can try this:-

    String dirFrom = "putYourPathToAssestsFolderHere"
    //if you are in an activity
    Resources res = getResources(); 
    AssetManager assets = res.getAssets();
    String fileList[] = assets.list(dirFrom);

        if (fileList != null)
        {   
            for ( int i = 0;i<fileList.length;i++)
            {
                Log.e(TAG, "readSamples: file name = "+fileList[i]); 
            }
        }
Salehin Rafi
  • 351
  • 2
  • 6
  • 16