本文整理匯總了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();
}
}
}
示例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();
}
}
}
示例3: test_handleUnsuccessful_networkError
@Test
public void test_handleUnsuccessful_networkError() {
Status status = new Status(CommonStatusCodes.NETWORK_ERROR);
activity.setResolvingError(false);
activity.handleUnsuccessfulNearbyResult(status);
}