Rahul Rahul - 1 year ago 117
Android Question

Can i store HTML files in drawable folde and use them for webview

How to store html files in Drawable in resource and access them.
I want html files inside the application i don't want to link them from localhost or from sdcard.

Answer Source

Instead copy your html file in assets directory and use it as follows

WebView webView = (WebView) findViewById(R.id.YourWebView);

You can not add html files in drawable folders because drawable directory is used for different purpose as follows from the docs.

Though usually not visible to the application, Drawables may take a variety of forms:

Bitmap: the simplest Drawable, a PNG or JPEG image.

Nine Patch: an extension to the PNG format allows it to specify information about how to stretch it and place things inside of it.

Shape: contains simple drawing commands instead of a raw bitmap, allowing it to resize better in some cases.

Layers: a compound drawable, which draws multiple underlying drawables on top of each other.

States: a compound drawable that selects one of a set of drawables based on its state. Levels: a compound drawable that selects one of a set of drawables based on its level. Scale: a compound drawable with a single child drawable, whose overall size is modified based on the current level.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download