Spread the love

In react native if you want to list all the assets (base directory files and folder), use the following in the onCreate method of MainApplication.java

AssetManager assetManager = getApplicationContext().getAssets();
      try {
        String[] filelist = assetManager.list("");
        System.out.println(fileList().length
        );
        System.out.println("The list of files.");
        for(String name:filelist){
          System.out.println(name);
        }
      } catch (Exception e) {
        System.out.println("IO Excpetion");
      }