Alex
Alex

Reputation: 7057

What is the absolute path of assets folder?

What is the absolute path of the assets folder? I need it to reference some images saved in this folder from a html file saved in the memory device.

Upvotes: 2

Views: 7025

Answers (1)

GeekYouUp
GeekYouUp

Reputation: 1651

To load an asset into an WebView the path would be

WebView webView = (WebView) findViewById(R.id...);
webView.loadUrl("file:///android_asset/xyz.html");

same would go for loading an image from assets into a WebView.

However, to my knowledge you can't load an asset from inside your apk in the devices default browser. To do this you'd first need to copy the asset from inside your apk into the phones memory.

Upvotes: 2

Related Questions