Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get folders name from Assets directory

Tags:

android

I'm trying to get the names of my folders in "assets". I can get the names of the files with an AssetManager by using the method assetManager.list(). But the problem is that it return only files' name and not folders' names. So I'm trying to use the listFiles() method but i can't access to the Assets directory; I've try the following :

File dir = new File ("file:///android_asset/");
File[] files= dir.listFiles();

But it doesn't work :( ... Is there a way to get the folders' names contained in the Assets directory ?

like image 432
Nox Avatar asked Nov 05 '22 11:11

Nox


1 Answers

The URL "file:///android_asset/" doesn't point to a particular directory, it is only used by WebView to address assets. Assets are read-only and defined at compile time, so it's assumed their directory structure is known to the programmer. It's inconvenient, but that's the way it's designed

like image 59
ognian Avatar answered Nov 15 '22 09:11

ognian