You can use saveWebArchive
. If you want to also save the resources such as images, you need to override onLoadResource()
static WebView getWebView(Activity activity, int id, String url) {
WebView w1 = activity.findViewById(id)
WebSettings wSettings = w1.getSettings();
wSettings.setJavaScriptEnabled(true);
wSettings.setAllowFileAccess(true);
wSettings.setAppCacheEnabled(true);
wSettings.setAppCachePath(activity.getBaseContext().getCacheDir().getAbsolutePath());
wSettings.setJavaScriptCanOpenWindowsAutomatically(true);
wSettings.setSavePassword(true);
wSettings.setSaveFormData(true);
wSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
wSettings.setUserAgentString("Android");
w1.setWebViewClient(new WebViewClient() {
…
Top comments (0)