Empty folder in Assets tree on Android
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开发者_Python百科 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!
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.
精彩评论