I create some folders into assets. Each folder contains files that I would like to list. I am using following code but I always get a null value for fileList. Thank you.
Simplest would surely be this:
String[] fileList = getAssets().list("images");
You'll probably want to do this:
private void listFiles(String dirFrom) {
Resources res = getResources(); //if you are in an activity
AssetManager am = res.getAssets();
String fileList[] = am.list(dirFrom);
if (fileList != null)
{
for ( int i = 0;i<fileList.length;i++)
{
Log.d("",fileList[i]);
}
}
}
Also your function call should be: listFiles("images");
if you want to list images.