List of usage examples for android.webkit WebViewClient ERROR_HOST_LOOKUP
int ERROR_HOST_LOOKUP
To view the source code for android.webkit WebViewClient ERROR_HOST_LOOKUP.
Click Source Link
From source file:Main.java
private static boolean canRetryWebView(Context context, int errorCode, String description, String failingUrl) { if (errorCode == WebViewClient.ERROR_CONNECT || errorCode == WebViewClient.ERROR_FAILED_SSL_HANDSHAKE || errorCode == WebViewClient.ERROR_HOST_LOOKUP || errorCode == WebViewClient.ERROR_TIMEOUT) { return true; } else {/*from ww w . j ava 2 s . c om*/ return false; } }
From source file:org.apache.cordova.CordovaActivity.java
/** * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable). * The errorCode parameter corresponds to one of the ERROR_* constants. * * @param errorCode The error code corresponding to an ERROR_* value. * @param description A String describing the error. * @param failingUrl The url that failed to load. *///from w ww .ja v a 2s. co m public void onReceivedError(final int errorCode, final String description, final String failingUrl) { final CordovaActivity me = this; // If errorUrl specified, then load it final String errorUrl = preferences.getString("errorUrl", null); if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) { // Load URL on UI thread me.runOnUiThread(new Runnable() { public void run() { me.appView.showWebPage(errorUrl, false, true, null); } }); } // If not, then display error dialog else { final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP); me.runOnUiThread(new Runnable() { public void run() { if (exit) { me.appView.getView().setVisibility(View.GONE); me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", exit); } } }); } }
From source file:com.webileapps.fragments.CordovaFragment.java
/** * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable). * The errorCode parameter corresponds to one of the ERROR_* constants. * * @param errorCode The error code corresponding to an ERROR_* value. * @param description A String describing the error. * @param failingUrl The url that failed to load. *//*from w ww . ja v a 2 s . c o m*/ public void onReceivedError(final int errorCode, final String description, final String failingUrl) { final CordovaFragment me = this; // If errorUrl specified, then load it final String errorUrl = preferences.getString("errorUrl", null); if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) { // Load URL on UI thread me.getActivity().runOnUiThread(new Runnable() { public void run() { me.appView.showWebPage(errorUrl, false, true, null); } }); } // If not, then display error dialog else { final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP); me.getActivity().runOnUiThread(new Runnable() { public void run() { if (exit) { me.appView.getView().setVisibility(View.GONE); me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", exit); } } }); } }
From source file:com.example.administrator.myapplication.fragment.CordovaFragment2.java
/** * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable). * The errorCode parameter corresponds to one of the ERROR_* constants. * * @param errorCode The error code corresponding to an ERROR_* value. * @param description A String describing the error. * @param failingUrl The url that failed to load. *///from w ww . j a v a 2 s . co m public void onReceivedError(final int errorCode, final String description, final String failingUrl) { final CordovaFragment2 me = this; // If errorUrl specified, then load it final String errorUrl = preferences.getString("errorUrl", null); if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) { // Load URL on UI thread me.getActivity().runOnUiThread(new Runnable() { public void run() { me.appView.showWebPage(errorUrl, false, true, null); } }); } // If not, then display error dialog else { final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP); me.getActivity().runOnUiThread(new Runnable() { public void run() { if (exit) { me.appView.getView().setVisibility(View.GONE); me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", exit); } } }); } }
From source file:edu.pitt.gis.uniapp.UniApp.java
/** * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable). * The errorCode parameter corresponds to one of the ERROR_* constants. * * @param errorCode The error code corresponding to an ERROR_* value. * @param description A String describing the error. * @param failingUrl The url that failed to load. *//*from w ww. j a v a2 s . c o m*/ public void onReceivedError(final int errorCode, final String description, final String failingUrl) { final UniApp me = this; // If errorUrl specified, then load it final String errorUrl = me.getStringProperty("errorUrl", "file:///android_asset/www/index.html"); if ((errorUrl != null) && (errorUrl.startsWith("file://") || errorUrl.indexOf(me.baseUrl) == 0 || this.appView.isUrlWhiteListed(errorUrl)) && (!failingUrl.equals(errorUrl))) { // Load URL on UI thread me.runOnUiThread(new Runnable() { public void run() { // Stop "app loading" spinner if showing me.spinnerStop(); me.appView.showWebPage(errorUrl, false, true, null); } }); } // If not, then display error dialog else { final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP); me.runOnUiThread(new Runnable() { public void run() { if (exit) { me.appView.setVisibility(View.GONE); me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", false); } } }); } }