本文整理汇总了Java中android.webkit.WebView.canGoBack方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.canGoBack方法的具体用法?Java WebView.canGoBack怎么用?Java WebView.canGoBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebView
的用法示例。
在下文中一共展示了WebView.canGoBack方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceivedError
import android.webkit.WebView; //导入方法依赖的package包/类
/**
* 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);
}
示例2: onKeyDown
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(event.getAction() == KeyEvent.ACTION_DOWN){
switch(keyCode)
{
case KeyEvent.KEYCODE_BACK:
WebView webviewHelp = (WebView)findViewById(R.id.webview_help);
if(webviewHelp.canGoBack() == true){
webviewHelp.goBack();
}else{
finish();
}
return true;
}
}
return super.onKeyDown(keyCode, event);
}
示例3: onKeyDown
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
WebView webView = getAUTWebView();
if (webView.canGoBack())
{
webView.goBack();
return false;
}
}
return super.onKeyDown(keyCode, event);
}
示例4: onBackPressed
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
WebView myWebView = (WebView) findViewById(R.id.webview);
if (myWebView.canGoBack() && mWebViewClient.allowBack()) {
myWebView.goBack();
} else {
super.onBackPressed();
}
}
示例5: canGoBack
import android.webkit.WebView; //导入方法依赖的package包/类
public boolean canGoBack() {
WebView view = null;
if (this.getView() != null && (view = this.getView().getWebView()) != null) {
return view.canGoBack();
}
return false;
}
示例6: canGoForward
import android.webkit.WebView; //导入方法依赖的package包/类
public boolean canGoForward() {
WebView view = null;
if (this.getView() != null && (view = this.getView().getWebView()) != null) {
return view.canGoBack();
}
return false;
}
示例7: onReceivedError
import android.webkit.WebView; //导入方法依赖的package包/类
/**
* 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);
}
示例8: onBackPressed
import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void onBackPressed() {
WebView webview = (WebView) findViewById(R.id.webview);
if (webview.canGoBack()) {
webview.goBack();
} else {
finish();
}
}