I need some help. I need to iterate through assets folder and find all files and subfolders and do something with them. For example . I have created folder "myicons" in assets folder. But this folder(myicons) include other folders which include icons. It looks like
/myicons/buttons/playbt.ico ,/myicons/buttons/stopbt.ico , /myicons/shapes/square.ico
and so on.
So I need to iterate through every subfolder but it doesn't work. AssetsManager.list(path)
returns only files .
Please suggest how to solve the problem. For example if getFromAssets(getAsset(),"myicons");
void getFromAssets (AssetManager mgr, String path) {
try {
String list[] = mgr.list(path);
if (list != null)
for (int i=0; i<list.length; ++i)
{
File file = new File(list[i]);
if (file.isDirectory()) {
Log.d("Assets:",list[i]+ "is Directory");
}
else {
Log.d("Assets:",list[i]+ "is File");
}
}
} catch (IOException e) {
Log.v("List error:", "can't list" + path);
}
}
The problem was that if I have my_icons folder and in this folder I have buttons folder it didn't recognize buttons folder. list method doesn't recognize EMPTY FOLDERS. Everything works if folder is not empty . Thx everyone for help. I will post code a bit later .