Empty folder in the asset tree on Android

I use AssetManager to display the contents of my data folder on Android. Everything works as expected, except when I have an empty subfolder. It is not included in the list. If I put the file in a folder, the folder and file do not detect problems.

Is this the expected behavior? I assume that under normal circumstances an empty folder is pretty useless as an asset and probably can be ignored, but I'm going to copy the folder hierarchy from the resource folder to the SD card, so including everything, even empty folders, would be best.

I did not find any documentation that addresses this particular issue.

Thanks!

+4
source share
1 answer

This is not uncommon when it comes to archive files and remember that apk files for Android packages are mostly zip files.

Some archive utilities allow you to include empty directories, but I do not know how to do this when creating Android apk. In the general case (for any archiving / packaging) I just include an empty text file called PlaceHolder.txt, which, obviously, forces you to create the right tree structure as you want.

+2
source

All Articles