gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-26 18:51:05 29 4
gpt4 key购买 nike

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

WebResourceError.getDescription介绍

暂无

代码示例

代码示例来源: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: stackoverflow.com

/*
  * Added in API level 23 replacing :-
  *
  * onReceivedError(WebView view, int errorCode, String description, String failingUrl) 
 */
 @Override
 public void onReceivedError(WebView view, WebResourceRequest request,
     WebResourceError error) {
   Toast.makeText(getActivity(),
       "WebView Error" + error.getDescription(),
       Toast.LENGTH_SHORT).show();
   super.onReceivedError(view, request, error);
 }
 /*
  Added in API level 23
 */
 @Override
 public void onReceivedHttpError(WebView view,
     WebResourceRequest request, WebResourceResponse errorResponse) {
   Toast.makeText(getActivity(),
       "WebView Error" + errorResponse.getReasonPhrase(),
       Toast.LENGTH_SHORT).show();
   super.onReceivedHttpError(view, request, errorResponse);
 }

代码示例来源: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: yangchong211/YCAudioPlayer

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
  super.onReceivedError(view, request, error);
  LogUtils.e("WebViewActivity-----onReceivedError-------" + error.toString());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    LogUtils.e("服务器异常" + error.getDescription().toString());
  }
  ToastUtils.showRoundRectToast("服务器异常6.0之后");
  //当加载错误时,就让它加载本地错误网页文件
  //mWebView.loadUrl("file:///android_asset/errorpage/error.html");
  showErrorPage();//显示错误页面
}

代码示例来源:origin: Unity-Technologies/unity-ads-android

@TargetApi(25)
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
  if (shouldCallSuper("onReceivedError")) {
    super.onReceivedError(view, request, error);
  }
  if (shouldSendEvent("onReceivedError")) {
    String description = "";
    if (error != null && error.getDescription() != null) {
      description = error.getDescription().toString();
    }
    String url = "";
    if (request != null && request.getUrl() != null) {
      url = request.getUrl().toString();
    }
    WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.WEBPLAYER, WebPlayerEvent.ERROR, url, description, viewId);
  }
}

代码示例来源: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: 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);
  }
}

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