ErrorStringspublic class ErrorStrings extends Object Localized strings for the error codes defined in EventHandler.
{@hide} |
Fields Summary |
---|
private static final String | LOGTAG |
Constructors Summary |
---|
private ErrorStrings() /* Utility class, don't instantiate. */
|
Methods Summary |
---|
public static int | getResource(int errorCode)Get the localized error message resource for the given error code.
If the code is unknown, we'll return a generic error message.
switch(errorCode) {
case EventHandler.OK:
return com.android.internal.R.string.httpErrorOk;
case EventHandler.ERROR:
return com.android.internal.R.string.httpError;
case EventHandler.ERROR_LOOKUP:
return com.android.internal.R.string.httpErrorLookup;
case EventHandler.ERROR_UNSUPPORTED_AUTH_SCHEME:
return com.android.internal.R.string.httpErrorUnsupportedAuthScheme;
case EventHandler.ERROR_AUTH:
return com.android.internal.R.string.httpErrorAuth;
case EventHandler.ERROR_PROXYAUTH:
return com.android.internal.R.string.httpErrorProxyAuth;
case EventHandler.ERROR_CONNECT:
return com.android.internal.R.string.httpErrorConnect;
case EventHandler.ERROR_IO:
return com.android.internal.R.string.httpErrorIO;
case EventHandler.ERROR_TIMEOUT:
return com.android.internal.R.string.httpErrorTimeout;
case EventHandler.ERROR_REDIRECT_LOOP:
return com.android.internal.R.string.httpErrorRedirectLoop;
case EventHandler.ERROR_UNSUPPORTED_SCHEME:
return com.android.internal.R.string.httpErrorUnsupportedScheme;
case EventHandler.ERROR_FAILED_SSL_HANDSHAKE:
return com.android.internal.R.string.httpErrorFailedSslHandshake;
case EventHandler.ERROR_BAD_URL:
return com.android.internal.R.string.httpErrorBadUrl;
case EventHandler.FILE_ERROR:
return com.android.internal.R.string.httpErrorFile;
case EventHandler.FILE_NOT_FOUND_ERROR:
return com.android.internal.R.string.httpErrorFileNotFound;
case EventHandler.TOO_MANY_REQUESTS_ERROR:
return com.android.internal.R.string.httpErrorTooManyRequests;
default:
Log.w(LOGTAG, "Using generic message for unknown error code: " + errorCode);
return com.android.internal.R.string.httpError;
}
| public static java.lang.String | getString(int errorCode, android.content.Context context)Get the localized error message resource for the given error code.
If the code is unknown, we'll return a generic error message.
return context.getText(getResource(errorCode)).toString();
|
|