当前位置: 首页>>代码示例>>Java>>正文


Java WebViewClient.ERROR_HOST_LOOKUP属性代码示例

本文整理汇总了Java中android.webkit.WebViewClient.ERROR_HOST_LOOKUP属性的典型用法代码示例。如果您正苦于以下问题:Java WebViewClient.ERROR_HOST_LOOKUP属性的具体用法?Java WebViewClient.ERROR_HOST_LOOKUP怎么用?Java WebViewClient.ERROR_HOST_LOOKUP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.webkit.WebViewClient的用法示例。


在下文中一共展示了WebViewClient.ERROR_HOST_LOOKUP属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceivedError

/**
 * 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 errorCode   The error code corresponding to an ERROR_* value.
 * @param description A String describing the error.
 * @param failingUrl  The url that failed to load.
 */
public void onReceivedError(final int errorCode, final String description, final String failingUrl) {
    final CordovaActivity me = this;

    // If errorUrl specified, then load it
    final String errorUrl = preferences.getString("errorUrl", null);
    if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) {
        // Load URL on UI thread
        me.runOnUiThread(new Runnable() {
            public void run() {
                me.appView.showWebPage(errorUrl, false, true, null);
            }
        });
    }
    // If not, then display error dialog
    else {
        final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP);
        me.runOnUiThread(new Runnable() {
            public void run() {
                if (exit) {
                    me.appView.getView().setVisibility(View.GONE);
                    me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", exit);
                }
            }
        });
    }
}
 
开发者ID:Andy-Ta,项目名称:COB,代码行数:34,代码来源:CordovaActivity.java

示例2: onReceivedError

/**
 * 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 errorCode    The error code corresponding to an ERROR_* value.
 * @param description  A String describing the error.
 * @param failingUrl   The url that failed to load.
 */
public void onReceivedError(final int errorCode, final String description, final String failingUrl) {
    final CordovaActivity me = this;

    // If errorUrl specified, then load it
    final String errorUrl = preferences.getString("errorUrl", null);
    if ((errorUrl != null) && (errorUrl.startsWith("file://") || internalWhitelist.isUrlWhiteListed(errorUrl)) && (!failingUrl.equals(errorUrl))) {

        // Load URL on UI thread
        me.runOnUiThread(new Runnable() {
            public void run() {
                me.appView.showWebPage(errorUrl, false, true, null);
            }
        });
    }
    // If not, then display error dialog
    else {
        final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP);
        me.runOnUiThread(new Runnable() {
            public void run() {
                if (exit) {
                    me.appView.setVisibility(View.GONE);
                    me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", exit);
                }
            }
        });
    }
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:35,代码来源:CordovaActivity.java

示例3: onWebViewReceivedError

public void onWebViewReceivedError(WebView view, int errorCode, CharSequence description, String failingUrl) {
    Log.i("0000", "errorCode:   " + errorCode);
    switch (errorCode) {
        case WebViewClient.ERROR_CONNECT:
        case WebViewClient.ERROR_TIMEOUT:
        case WebViewClient.ERROR_HOST_LOOKUP:
        case WebViewClient.ERROR_BAD_URL:
            showErrorHint(failingUrl);
            break;
    }
}
 
开发者ID:CardInfoLink,项目名称:QRScanner,代码行数:11,代码来源:BaseWebActivity.java


注:本文中的android.webkit.WebViewClient.ERROR_HOST_LOOKUP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。