Hello people, I come all day wanting to solve this. I have a Main activity that has a WebView. This activity is attentive to the connection to the internet. When you do not have an Internet connection, you will be set up with a new Layout containing a button, to re-try to connect again.
Change Layout using setContentView (R.layout.sin_conexion);
When re-trying to connect from the button of that layout. The WebView remains blank. The Toast responds and I do not know how to make the WebView show me again like when I open the APP. Please someone to give me any suggestions, ideas, anything?
Thank you very much in advance.
public void intento (View view){
Toast.makeText(Web.this, "REINTENTANDO", Toast.LENGTH_LONG).show();
setContentView(R.layout.activity_web_view);
web.setWebViewClient(new MyWebViewClient());
WebSettings settings = web.getSettings();
settings.setJavaScriptEnabled(true);
web.loadUrl(url);
}
private class MyWebViewClient extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}