Question

Is there a way to load an android asset without using the AssetManager?

I am using a separate java library (compiled into my application) to load some files. It requires a java URL. Is there anyway to specify in a URL an android Asset and have it load just like a file?

A webview can load the same asset using the following code. Is it parsing the path, determining it is an asset and loading it differently?

WebView wvHelp = (WebView)findViewById(R.id.wv_settings_help);
wvHelp.loadUrl("file:///android_asset/" + fileName);
Was it helpful?

Solution 2

After a lot of research and trying other mechanisms, I believe the answer here is no. You have to use the AssetManager to load from the android assets.

OTHER TIPS

I'm not sure if you could use this experience in your case, but I had worked on something similar recently. My customer have a server with data on it, different assets (images, sounds...). An XML file on the server is structured to link (as a db-like) to the different locations of the assets, but more, the tags are used for "image background", "image buttons", "page title", and so on. In my app, I retrieve the XML accessing to the server, I use a SAX parser class to read the tags, I got the different link to the different assets, I go onto the server suitably the link read and I charge my app with the assets, parsing them suitably the tag retrieved. As an example, for a tag "image button", I have the link of an image and I charge the image button variable with this asset, without issues.

I hope it is clear.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top