Answer the question
In order to leave comments, you need to log in
How to open local html file in webview?
The application saves the web page archive in the html file. If you click in Android studio Copy Path, then the file is located here in the phone's memory /data/data/com.example.example/files/archiv.html"
How to open the saved archiv.html file in webviwe
Not working options:
webview.loadUrl(" file :///data/data/com.example.example/files/archiv.html ");
File file = new File("/data/data/com.example.example/files/archiv.html");
webView. loadUrl("file://" + file);
The option of uploading a file to the program project to the asset folder is not suitable, since the file is saved on the device after compilation and cannot be transferred to the project.
Answer the question
In order to leave comments, you need to log in
File file = new File("/data/data/com.example.example/files/archiv.html");
webView.loadUrl("file://" + file);
webView.loadData(currentHTML, "text/html; charset=utf-8", "utf-8");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question