gpt4 book ai didi

android.webkit.WebResourceError.getErrorCode()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 19:31:05 28 4
gpt4 key购买 nike

本文整理了Java中android.webkit.WebResourceError.getErrorCode()方法的一些代码示例,展示了WebResourceError.getErrorCode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebResourceError.getErrorCode()方法的具体详情如下:
包路径:android.webkit.WebResourceError
类名称:WebResourceError
方法名:getErrorCode

WebResourceError.getErrorCode介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

@SuppressWarnings("deprecation")
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
  // Handle the error
}

@TargetApi(android.os.Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr) {
  // Redirect to deprecated method, so you can use it in all SDK versions
  onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString());
}

代码示例来源:origin: Justson/AgentWeb

@Override
  public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {

    if (AgentWebUtils.isOverriedMethod(mWebViewClient, "onReceivedError", ANDROID_WEBVIEWCLIENT_PATH + ".onReceivedError", WebView.class, WebResourceRequest.class, WebResourceError.class)) {
      super.onReceivedError(view, request, error);
//            return;
    }
    if (request.isForMainFrame()) {
      onMainFrameError(view,
          error.getErrorCode(), error.getDescription().toString(),
          request.getUrl().toString());
    }
    LogUtils.i(TAG, "onReceivedError:" + error.toString());
  }

代码示例来源:origin: xtools-at/Android-PWA-Wrapper

@TargetApi(Build.VERSION_CODES.M)
  @Override
  public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      // new API method calls this on every error for each resource.
      // we only want to interfere if the page itself got problems.
      String url = request.getUrl().toString();
      if (view.getUrl().equals(url)) {
        handleLoadError(error.getErrorCode());
      }
    }
  }
});

代码示例来源:origin: stackoverflow.com

private class myWebViewBrowser extends WebViewClient {

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {

  Log.e(String.valueOf(error.getErrorCode()), error.getDescription().toString());
  view.loadDataWithBaseURL( "file:///android_asset/", html, "text/html","utf-8", null );   
  }
}

代码示例来源:origin: stackoverflow.com

@Override
 public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
   Log.e(String.valueOf(error.getErrorCode()), error.getDescription().toString());
   view.loadDataWithBaseURL( "file:///android_asset/", html, "text/html","utf-8", null );   
   }

代码示例来源:origin: rignaneseleo/SlimSocial-for-Facebook

@TargetApi(android.os.Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr) {
  // Redirect to deprecated method, so you can use it in all SDK versions
  onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString());
}

代码示例来源:origin: indywidualny/FaceSlim

@TargetApi(android.os.Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError err) {
  // redirect to deprecated method, so we can use it in all SDK versions
  onReceivedError(view, err.getErrorCode(), err.getDescription().toString(), req.getUrl().toString());
}

代码示例来源:origin: stackoverflow.com

@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
  //Handle the error
  super.onReceivedError(view, errorCode, description, failingUrl);
}

@TargetApi(Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr){
  onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString());
}

代码示例来源:origin: stackoverflow.com

webView.setWebViewClient(new WebViewClient() {
 @SuppressWarnings("deprecation")
 @Override
 public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
   if(errorCode == 404){
       Log.d("Webview", "Invalid URL: "+url);
   }
   else if(errorCode == 500){
      Log.d("Webview", "Internal Server error: "+url);
   }
 }

 @TargetApi(android.os.Build.VERSION_CODES.M)
 @Override
 public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr) {
  // Redirect to deprecated method, so you can use it in all SDK versions
  onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString());
 }
});

代码示例来源:origin: stackoverflow.com

webView.setWebViewClient(new WebViewClient() {
   @SuppressWarnings("deprecation")
   @Override
   public void onReceivedError(WebView view, int errorCode,
                 String description, String failingUrl) {
     // TODO Auto-generated method stub
     super.onReceivedError(view, errorCode, description, failingUrl);
     webView
         .loadData(
             "<div>Please check your internet connection.</div>",
             "text/html", "UTF-8");
   }
   @TargetApi(android.os.Build.VERSION_CODES.M)
   @Override
   public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr) {
     // Redirect to deprecated method, so you can use it in all SDK versions
     onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString());
   }
 });

代码示例来源:origin: stackoverflow.com

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
  handleError(error.getErrorCode());

代码示例来源:origin: vic797/prowebview

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
  if (Build.VERSION.SDK_INT>=23) {
    ProWebResourceError webResourceError = new ProWebResourceError(error.getDescription(), error.getErrorCode());
    boolean redir = false;
    if (Build.VERSION.SDK_INT>=24)
      redir = request.isRedirect();
    ProWebResourceRequest resourceRequest = new ProWebResourceRequest(request.getMethod(), request.getRequestHeaders(), request.getUrl(), request.hasGesture(), request.isForMainFrame(), redir);
    if (proClient != null)
      proClient.onReceivedError(ProWebView.this, resourceRequest,webResourceError);
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com