i want to store webpages inside the android project folder so that a user does nor needs a internet connection to view the webpages. i am using android webview. i am able to see the webpages with the HTTP protocol . My code is as below:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
WebView webview = (WebView) findViewById(R.id.webView1);
// webview.loadUrl("http://www.mysite.com/index.html");
webview.getSettings().setJavaScriptEnabled(true);
}
but i want to see the webpages offline. is there any way that webpages can be stored as resource in android project folder and view even without internet connection?
yes !
Put them in the
/assetsfolder and access them like this :This questions already have been answered : Webview load html from assets directory