當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。