Detecting Webview Error and Show Message
All answer above are deprecated.You should use this code after on Page finished
@Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error){ //Your code to do Toast.makeText(getActivity(), "Your Internet Connection May not be active Or " + error.getDescription(), Toast.LENGTH_LONG).show(); }
Add this after onpagefinished :
public void onReceivedError(WebView view, int errorCod,String description, String failingUrl) { Toast.makeText(Webform.this, "Your Internet Connection May not be active Or " + description , Toast.LENGTH_LONG).show(); }
Don't forget to import android.widget.Toast;