blob: 366bb3d3f17c90747ed8c04cb5b7cfc33a0d1770 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package de.podfetcher.util;
import de.podfetcher.R;
import android.app.DownloadManager;
import android.content.Context;
/** Utility class for Download Errors. */
public class DownloadError {
public static final int ERROR_PARSER_EXCEPTION = 1;
public static final int ERROR_UNSUPPORTED_TYPE = 2;
public static final int ERROR_CONNECTION_ERROR = 3;
/** Get a human-readable string for a specific error code. */
public static String getErrorString(Context context, int code) {
int resId;
switch(code) {
case DownloadManager.ERROR_DEVICE_NOT_FOUND:
resId = R.string.download_error_insufficient_space;
break;
case DownloadManager.ERROR_FILE_ERROR:
resId = R.string.download_error_file_error;
break;
case DownloadManager.ERROR_HTTP_DATA_ERROR:
resId = R.string.download_error_http_data_error;
break;
case ERROR_PARSER_EXCEPTION:
resId = R.string.download_error_parser_exception;
break;
case ERROR_UNSUPPORTED_TYPE:
resId = R.string.download_error_unsupported_type;
break;
case ERROR_CONNECTION_ERROR:
resId = R.string.download_error_connection_error;
break;
default:
resId = R.string.download_error_error_unknown;
}
return context.getString(resId);
}
}
|