本文整理匯總了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);
}