I ran into the same problem recently (I wanted to copy some files from the resource directory), and this was in the application location, where for a few seconds the wait was simply not going to cut it. AssetManager.list () is too slow. So I came up with a solution, it is ugly, but it is fast.
At least in my case, since the resource folder is created using the application, I do not often change it. Therefore, the solution I came up with was to include the file in the asset directory, which lists all the files in the assets. For instance:
somedir/somefile.txt somedir/anotherdir/anotherfile.txt somedir/anotherdir/yetanotherfile.txt somedir/anotherdir/somanyfiles.txt ...
Therefore, it loads this list and then iterates over the list, rather than calling AssetManager.list ();
This is ugly or elegant, and probably violates all kinds of encoding methods, but in my case it took from 30 seconds to 300 milliseconds, so in my case it was worth it.
If your resource folder changes a lot and it would be painful to manually update the list, you could probably add a script to your build process, which would automatically create this directory file for you during the build.
source share