In my application i have one HTML file and i save this in specific folder!
I want open this file into WebView
and for his i write below codes.
When run application and open WebView
show me Web page not available error on WebView
!
My codes:
htmlReaderPage_reader.getSettings().setJavaScriptEnabled(true);
htmlReaderPage_reader.setInitialScale(1);
htmlReaderPage_reader.getSettings().setLoadWithOverviewMode(true);
htmlReaderPage_reader.getSettings().setUseWideViewPort(true);
htmlReaderPage_reader.getSettings().setBuiltInZoomControls(false);
htmlReaderPage_reader.getSettings().setPluginState(WebSettings.PluginState.ON);
htmlReaderPage_reader.getSettings().setDomStorageEnabled(true);
htmlReaderPage_reader.getSettings().setDatabaseEnabled(true);
htmlReaderPage_reader.setWebViewClient(new WebViewClient());
htmlReaderPage_reader.setVerticalScrollBarEnabled(true);
htmlReaderPage_reader.setHorizontalScrollBarEnabled(true);
htmlReaderPage_reader.loadUrl("file:///root/sdcard/my_folder/index.html");
UPDATE:
I change my code with this:
htmlReaderPage_reader.loadUrl("file:///"+Environment.getExternalStorageDirectory().getPath() + "/my_folder/index.html");
but again not read this html file!
How can i fix this and open Html file from specific folder?
Because you need to read de internal folder
First you need to locate the file in assets
assets/index.html
Atfer read the file
/app/src/main/assets/index.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.