本文整理汇总了Java中android.webkit.WebResourceError类的典型用法代码示例。如果您正苦于以下问题:Java WebResourceError类的具体用法?Java WebResourceError怎么用?Java WebResourceError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebResourceError类属于android.webkit包,在下文中一共展示了WebResourceError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError webResourceError) {
String errMsg = "WebViewError:";
if (webResourceError != null) {
if (webResourceError.getErrorCode() == -2) {
//view.loadData("<div></div>", "text/html", "UTF-8");
}
errMsg += webResourceError.getErrorCode() + "-" ;
errMsg += webResourceError.getDescription() + "-";
if (request != null && request.getUrl() != null) {
errMsg += request.getUrl().toString();
}
}
if (errMsg.contains("favicon.ico")) {
return;
}
controlsViewClient.handleKControlsError(new KPError(errMsg));
}
示例2: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
Crashlytics.log(5, "KolibriWebView",
"onReceivedError() called with: request = [" + request + "], error = [" + error + "]");
// We ignore errors regarding assets loading,
// so in this case we check if the request url and webview url are same
if (request.getUrl().toString().equals(view.getUrl()) || request.isForMainFrame()) {
for (KolibriWebViewClient webClient : webClients) {
webClient.onReceivedError(view, request, error);
}
}
}
示例3: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
String errorHtml = "<html><body><h2>找不到网页</h2></body></html>";
view.loadDataWithBaseURL(null, errorHtml, "text/html", "UTF-8", null);
}
示例4: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
if (AgentWebUtils.isOverriedMethod(mWebViewClient, "onReceivedError", WEBVIEWCLIENTPATH + ".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());
}
示例5: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
if(mWebViewClient!=null){
mWebViewClient.onReceivedError(view,request,error);
return;
}
super.onReceivedError(view,request,error);
}
示例6: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
/**
* Fires in cases where the webview cannot even load (e.g. no network)
*/
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
onReceivedError(view,
error.getErrorCode(),
error.getDescription().toString(),
request.getUrl().toString());
}
示例7: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
LogUtils.d("savor:webview "+error.getDescription());
isLoadError = true;
if (updateProgressListener!=null){
updateProgressListener.loadHttpError();
}
}
示例8: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
isLoadError = true;
if (updateProgressListener!=null){
updateProgressListener.loadHttpError();
}
}
示例9: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
if (mCustomWebViewClient!=null){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mCustomWebViewClient.onReceivedError(view, request, error);
}
return;
}
super.onReceivedError(view, request, error);
}
示例10: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
// Log the error message for debugging
Log.d(getClass().getSimpleName(), error.toString());
// Display toast message describing error details
String errorDetails = String.valueOf(error.getDescription());
Toast.makeText(mContext, errorDetails, Toast.LENGTH_LONG).show();
}
示例11: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@TargetApi(android.os.Build.VERSION_CODES.M)
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
// Redirect to deprecated method, so you can use it in all SDK versions
onReceivedError(view, error.getErrorCode(), error.getDescription().toString(), request.getUrl().toString());
}
示例12: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request,
WebResourceError error) {
super.onReceivedError(view, request, error);
if (mTvPlayActivity.get() != null) {
mTvPlayActivity.get().sendParseDataMessage(LOAD_DATA_ERROR);
}
}
示例13: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
mEmptyLayout.setErrorType(EmptyLayout.NODATA);
if (callback != null) {
callback.onReceivedError(view, request, error);
}
}
示例14: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(final WebView view, WebResourceRequest request,
WebResourceError error) {
super.onReceivedError(view, request, error);
final EmptyLayout emptyLayout = viewDelegate.get(R.id.emptylayout);
emptyLayout.setOnLayoutClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
view.loadUrl(view.getUrl());
emptyLayout.setErrorType(EmptyLayout.NETWORK_LOADING);
}
});
emptyLayout.setErrorType(EmptyLayout.NETWORK_ERROR);
}
示例15: onReceivedError
import android.webkit.WebResourceError; //导入依赖的package包/类
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
UIUtil.showToast(WebPageActivity.this, error.toString());
mProgressBar.setVisibility(View.GONE);
}