當前位置: 首頁>>代碼示例>>Java>>正文


Java CommonStatusCodes.NETWORK_ERROR屬性代碼示例

本文整理匯總了Java中com.google.android.gms.common.api.CommonStatusCodes.NETWORK_ERROR屬性的典型用法代碼示例。如果您正苦於以下問題:Java CommonStatusCodes.NETWORK_ERROR屬性的具體用法?Java CommonStatusCodes.NETWORK_ERROR怎麽用?Java CommonStatusCodes.NETWORK_ERROR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.android.gms.common.api.CommonStatusCodes的用法示例。


在下文中一共展示了CommonStatusCodes.NETWORK_ERROR屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleUnsuccessfulNearbyResult

private void handleUnsuccessfulNearbyResult(Status status) {
    Log.v(TAG, "Processing error, status = " + status);
    if (mResolvingError) {
        // Already attempting to resolve an error.
        return;
    } else if (status.hasResolution()) {
        try {
            mResolvingError = true;
            status.startResolutionForResult(getActivity(),
                    REQUEST_RESOLVE_ERROR);
        } catch (IntentSender.SendIntentException e) {
            mResolvingError = false;
            Log.v(TAG, "Failed to resolve error status.", e);
        }
    } else {
        if (status.getStatusCode() == CommonStatusCodes.NETWORK_ERROR) {
            Toast.makeText(getActivity(),
                    "No connectivity, cannot proceed. Fix in 'Settings' and try again.",
                    Toast.LENGTH_LONG).show();
        } else {
            // To keep things simple, pop a toast for all other error messages.
            Toast.makeText(getActivity(), "Unsuccessful: " +
                    status.getStatusMessage(), Toast.LENGTH_LONG).show();
        }
    }
}
 
開發者ID:NordicSemiconductor,項目名稱:Android-nRF-Beacon-for-Eddystone,代碼行數:26,代碼來源:BeaconsFragment.java

示例2: handleUnsuccessfulNearbyResult

@VisibleForTesting
protected void handleUnsuccessfulNearbyResult(Status status) {
    Log.v(TAG, "Processing error, status = " + status);

    if (resolvingError) {
        // Already attempting to resolve an error.
        return;
    } else if (status.hasResolution()) {
        try {
            resolvingError = true;
            status.startResolutionForResult(this, REQUEST_RESOLVE_ERROR);
        } catch (Exception e) {
            resolvingError = false;
            Log.v(TAG, "Failed to resolve error status.", e);
        }
    } else {
        if (status.getStatusCode() == CommonStatusCodes.NETWORK_ERROR) {
            Toast.makeText(this,
                    "No connectivity, cannot proceed. Fix in 'Settings' and try again.",
                    Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(this, "Unsuccessful: " + status.getStatusMessage(),
                    Toast.LENGTH_LONG).show();
        }
    }
}
 
開發者ID:sourceallies,項目名稱:zonebeacon,代碼行數:26,代碼來源:TransferActivity.java

示例3: test_handleUnsuccessful_networkError

@Test
public void test_handleUnsuccessful_networkError() {
    Status status = new Status(CommonStatusCodes.NETWORK_ERROR);
    activity.setResolvingError(false);
    activity.handleUnsuccessfulNearbyResult(status);
}
 
開發者ID:sourceallies,項目名稱:zonebeacon,代碼行數:6,代碼來源:TransferActivityTest.java


注:本文中的com.google.android.gms.common.api.CommonStatusCodes.NETWORK_ERROR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。