Java Code Examples for android.webkit.WebView#canGoBack()
The following examples show how to use
android.webkit.WebView#canGoBack() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemWebViewClient.java From app-icon with MIT License | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 2
Source File: SystemWebViewClient.java From chappiecast with Mozilla Public License 2.0 | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 3
Source File: SystemWebViewClient.java From cordova-plugin-intent with MIT License | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 4
Source File: SystemWebViewClient.java From a2cardboard with Apache License 2.0 | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 5
Source File: SystemWebViewClient.java From lona with GNU General Public License v3.0 | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 6
Source File: SystemWebViewClient.java From countly-sdk-cordova with MIT License | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override @SuppressWarnings("deprecation") public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 7
Source File: SystemWebViewClient.java From cordova-plugin-app-update-demo with MIT License | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 8
Source File: SystemWebViewClient.java From BigDataPlatform with GNU General Public License v3.0 | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 9
Source File: SystemWebViewClient.java From keemob with MIT License | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override @SuppressWarnings("deprecation") public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 10
Source File: SystemWebViewClient.java From keemob with MIT License | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override @SuppressWarnings("deprecation") public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 11
Source File: SystemWebViewClient.java From ultimate-cordova-webview-app with MIT License | 6 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { parentEngine.client.clearLoadTimeoutTimer(); if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } parentEngine.client.onReceivedError(errorCode, description, failingUrl); }
Example 12
Source File: MainActivity.java From VyAPI with MIT License | 6 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(event.getAction() == KeyEvent.ACTION_DOWN){ switch (keyCode){ case KeyEvent.KEYCODE_BACK: WebView webView = ViewWebsiteFragment.wv_personal_website; if(webView.canGoBack()){ webView.goBack(); } else{ finish(); } return true; } } return super.onKeyDown(keyCode, event); }
Example 13
Source File: MainActivity.java From United4 with GNU General Public License v3.0 | 5 votes |
@Override public void onBackPressed() { WebView webview = getWebView(); if (webview.canGoBack()) { webview.goBack(); } else { finish(); } }
Example 14
Source File: WebViewPresenterImpl.java From AdBlockedWebView-Android with MIT License | 5 votes |
@Override public void onBackPressed(PopupWindow menu, WebView webView) { if (menu.isShowing()) { mView.closeMenu(); } else if (webView.canGoBack()) { mView.goBack(); } else { mView.close(); } }
Example 15
Source File: CordovaWebViewClient.java From reader with MIT License | 5 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // Clear timeout flag this.appView.loadUrlTimeout++; // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } // Handle other errors by passing them to the webview in JS JSONObject data = new JSONObject(); try { data.put("errorCode", errorCode); data.put("description", description); data.put("url", failingUrl); } catch (JSONException e) { e.printStackTrace(); } this.appView.postMessage("onReceivedError", data); }
Example 16
Source File: CordovaWebViewClient.java From IoTgo_Android_App with MIT License | 5 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // Clear timeout flag this.appView.loadUrlTimeout++; // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } // Handle other errors by passing them to the webview in JS JSONObject data = new JSONObject(); try { data.put("errorCode", errorCode); data.put("description", description); data.put("url", failingUrl); } catch (JSONException e) { e.printStackTrace(); } this.appView.postMessage("onReceivedError", data); }
Example 17
Source File: VenvyWebView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
@Override public boolean canGoBack() { if (mAgentWeb == null || mAgentWeb.getWebCreator() == null) { return false; } WebView webView = mAgentWeb.getWebCreator().getWebView(); return webView != null ? webView.canGoBack() : false; }
Example 18
Source File: WebFragment.java From PowerFileExplorer with GNU General Public License v3.0 | 5 votes |
@Override public void onPageFinished(WebView view, String url) { //Log.d(TAG, "onPageFinished " + url + ", " + urlTv.getVisibility() + ", " + urlTv.getText()); BroadCastManager.onPageFinished(WebFragment.this.getContext(), key, url); if (updateTitleFromHtml) titleHtml.setText(view.getTitle()); urlTv.setText(url);//UrlParser.getHost(url)); requestCenterLayout(); if (view.canGoBack()) { back.setVisibility(showIconBack ? View.VISIBLE : View.GONE); back.setEnabled(!disableIconBack && (rtl ? view.canGoForward() : view.canGoBack())); } else { back.setVisibility(View.GONE); } if (view.canGoForward()) { forward.setVisibility(showIconForward ? View.VISIBLE : View.GONE); forward.setEnabled(!disableIconForward && (rtl ? view.canGoBack() : view.canGoForward())); } else { forward.setVisibility(View.GONE); } if (injectJavaScript != null) { webView.evaluateJavascript(injectJavaScript, null); } }
Example 19
Source File: CordovaWebViewClient.java From bluemix-parking-meter with MIT License | 5 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // Clear timeout flag this.appView.loadUrlTimeout++; // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } // Handle other errors by passing them to the webview in JS JSONObject data = new JSONObject(); try { data.put("errorCode", errorCode); data.put("description", description); data.put("url", failingUrl); } catch (JSONException e) { e.printStackTrace(); } this.appView.postMessage("onReceivedError", data); }
Example 20
Source File: CordovaWebViewClient.java From reader with MIT License | 5 votes |
/** * 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 view The WebView that is initiating the callback. * @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. */ @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Ignore error due to stopLoading(). if (!isCurrentlyLoading) { return; } LOG.d(TAG, "CordovaWebViewClient.onReceivedError: Error code=%s Description=%s URL=%s", errorCode, description, failingUrl); // Clear timeout flag this.appView.loadUrlTimeout++; // If this is a "Protocol Not Supported" error, then revert to the previous // page. If there was no previous page, then punt. The application's config // is likely incorrect (start page set to sms: or something like that) if (errorCode == WebViewClient.ERROR_UNSUPPORTED_SCHEME) { if (view.canGoBack()) { view.goBack(); return; } else { super.onReceivedError(view, errorCode, description, failingUrl); } } // Handle other errors by passing them to the webview in JS JSONObject data = new JSONObject(); try { data.put("errorCode", errorCode); data.put("description", description); data.put("url", failingUrl); } catch (JSONException e) { e.printStackTrace(); } this.appView.postMessage("onReceivedError", data); }