当前位置: 首页>>代码示例>>Java>>正文


Java WebView.goBack方法代码示例

本文整理汇总了Java中android.webkit.WebView.goBack方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.goBack方法的具体用法?Java WebView.goBack怎么用?Java WebView.goBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.WebView的用法示例。


在下文中一共展示了WebView.goBack方法的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);
}
 
开发者ID:Andy-Ta,项目名称:COB,代码行数:33,代码来源:SystemWebViewClient.java

示例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);
}
 
开发者ID:woshiwpa,项目名称:SmartMath,代码行数:19,代码来源:ActivityShowHelp.java

示例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);
}
 
开发者ID:SOASTA,项目名称:touchtestweb-android,代码行数:15,代码来源:MainActivity.java

示例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();
    }
}
 
开发者ID:jsparber,项目名称:CaptivePortalAutologin,代码行数:10,代码来源:CaptivePortalLoginActivity.java

示例5: goBack

import android.webkit.WebView; //导入方法依赖的package包/类
public UDWebView goBack() {
    WebView view = null;
    if (this.getView() != null && (view = this.getView().getWebView()) != null) {
        view.goBack();
    }

    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:9,代码来源:UDWebView.java

示例6: 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);
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:44,代码来源:CordovaWebViewClient.java

示例7: receiveCommand

import android.webkit.WebView; //导入方法依赖的package包/类
@Override
public void receiveCommand(WebView root, int commandId, @Nullable ReadableArray args) {
  switch (commandId) {
    case COMMAND_GO_BACK:
      root.goBack();
      break;
    case COMMAND_GO_FORWARD:
      root.goForward();
      break;
    case COMMAND_RELOAD:
      root.reload();
      break;
    case COMMAND_STOP_LOADING:
      root.stopLoading();
      break;
    case COMMAND_POST_MESSAGE:
      try {
        JSONObject eventInitDict = new JSONObject();
        eventInitDict.put("data", args.getString(0));
        root.loadUrl("javascript:(function () {" +
          "var event;" +
          "var data = " + eventInitDict.toString() + ";" +
          "try {" +
            "event = new MessageEvent('message', data);" +
          "} catch (e) {" +
            "event = document.createEvent('MessageEvent');" +
            "event.initMessageEvent('message', true, true, data.data, data.origin, data.lastEventId, data.source);" +
          "}" +
          "document.dispatchEvent(event);" +
        "})();");
      } catch (JSONException e) {
        throw new RuntimeException(e);
      }
      break;
    case COMMAND_INJECT_JAVASCRIPT:
      root.loadUrl("javascript:" + args.getString(0));
      break;
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:40,代码来源:ReactWebViewManager.java

示例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();
    }
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:10,代码来源:DonateActivity.java


注:本文中的android.webkit.WebView.goBack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。