I am trying to get recursively load all the assets I have placed within the "assets" folder within my project. When I do the following:
AssetManager assetManager = getResources().getAssets();
String assets[] = assetManager.list("");
and the check what strings were loaded into the assets array, I find the assets I have placed within the specified folder, along with the strings "images", "sounds", and "webkit". Does anyone know why this is?
For background information (don't yet know if it is applicable), my assets are zip files that contain complete html webpages, which I use to load into WebViews.
In my case, I was creating the assets folder inside the "app" directory of the project (app -> assets), and the files I loaded into this "assets" folder were not being read by the AssetsManager. Then I right clicked on the "app" folder -> New -> Folder -> Assets Folder (location "main") and everything was resolved. The problem was with the location where the "assets" folder was being created.
i had this problem and i suggest you check couple of things:
for example:
assets->app->image
,assets->app->another
dir.in this example the app dir is the only dir in the asssete root.
I also have noted this. Here are some assets that are placed in those directories:
My guess is that system relies on this assets to be present in all .apk files. But instead of building them in (which would increase size of all .apk files), Android emulates them via asset API.
Also, as a side-effect, you can override this assets with any custom asset that has same name as built-in one. Not that this may be too useful, but this is possible.