When there is no network, it is recommended to load the non-network html and other resource files under the assets folder to give users a no-network prompt.
In fact, it’s simpler. You can implement this interface directly without network (without using webview, just use an imageview, textview, and button to lay out the layout). When the webpage can be loaded, the webview will be displayed
As @sens said, not only the webview will have loading errors, but other pages will have loading errors, so it is recommended to adopt @sens's solution and write a refreshData(...) method in BaseActivity. Just click to refresh this page.
It can be downloaded even when there is no network. Where can I download it?
When there is no network, it is recommended to load the non-network html and other resource files under the assets folder to give users a no-network prompt.
Sample code:
This involves js and Android interaction, please see my other answer:
Click the button and refresh the webview in js
In fact, it’s simpler. You can implement this interface directly without network (without using webview, just use an imageview, textview, and button to lay out the layout). When the webpage can be loaded, the webview will be displayed
As @sens said, not only the webview will have loading errors, but other pages will have loading errors, so it is recommended to adopt @sens's solution and write a refreshData(...) method in BaseActivity. Just click to refresh this page.