Reputation: 43
I'm using the AssetManager to list the contents of my assets folder on Android. Everything is working as expected except for if I have an empty subfolder. It is not included in the list. If I put a file in the folder, the folder and the file show up no problem.
Is this the expected behavior? I imagine that under normal circumstances an empty folder is pretty useless as an asset and can probably be ignored, but I am intending to copy the folder hierarchy out of the assets folder to the SD card, so including everything, even empty folders, would be best.
I haven't found any documentation that covers this particular issue.
Thanks!
Upvotes: 4
Views: 882
Reputation: 48871
This isn't unusual when it comes to archive files and remember Android package apk files are basically zip files.
Some archive utilities allow a switch for including empty directories but I don't know a way of doing that when building an Android apk. In general (for any archiving / packaging) I simply include an empty text file called PlaceHolder.txt which will obviously force creation of the correct tree structure as you want.
Upvotes: 2