Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

It is possible to search for a file with a desired extension in assets folder?

I have an app with randomly generated assets folder. In that assets folder, each time my app opens, i must open a file with ".jet" extension. The problem is that the file will have a different random name each time the app opens.

So. How can i search for the first file of assets folder with ".jet" extension?

I can't find any info about that in google

Thanks

like image 829
NullPointerException Avatar asked Dec 03 '25 22:12

NullPointerException


1 Answers

The only way is to search for the extensions:

AssetManager am = getAssets();
String fileList[] = am.list("");

for (String fileName : fileList) {
      if (fileName.endsWith(".jet") {

       }
}
like image 183
Blackbelt Avatar answered Dec 06 '25 10:12

Blackbelt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!