src/main/java/de/blau/android/util/DownloadActivity.java
/**
         * Get a human readable error message from the error code
         * 
         * @param ctx Android Context
         * @param error the error code
         * @param filename the name of the file that the error applies to
         * @return a String with the message
         */
Get a human readable error message from the error code

@param ctx Android Context
@param error the error code
@param filename the name of the file that the error applies to
@return a String with the message
Get a human readable error message from the error code @param ctx Android Context @param error the error code @param filename the name of the file that the error applies to @return a String with the message
private String errorMessage(@NonNull Context ctx, int error, @NonNull String filename) {
            int res;
            switch (error) {
            case DownloadManager.ERROR_CANNOT_RESUME:
                res = R.string.toast_cannot_resume_download_of;
                break;
            case DownloadManager.ERROR_DEVICE_NOT_FOUND:
                res = R.string.toast_device_not_found_for;
                break;
            case DownloadManager.ERROR_FILE_ALREADY_EXISTS:
                res = R.string.toast_file_already_exists;
                break;
            case DownloadManager.ERROR_FILE_ERROR:
                res = R.string.toast_file_error_for;
                break;
            case DownloadManager.ERROR_HTTP_DATA_ERROR:
                res = R.string.toast_http_data_error_for;
                break;
            case DownloadManager.ERROR_INSUFFICIENT_SPACE:
                res = R.string.toast_error_insufficient_space_for;
                break;
            case DownloadManager.ERROR_TOO_MANY_REDIRECTS:
                res = R.string.toast_error_too_many_redirects_for;
                break;
            case DownloadManager.ERROR_UNHANDLED_HTTP_CODE:
                res = R.string.toast_error_too_unhandled_http_code_for;
                break;
            case DownloadManager.ERROR_UNKNOWN:
            default:
                res = R.string.toast_unknown_error_for;
            }
            return ctx.getString(res, filename);
        }
private String errorMessage ( @ NonNull Context ctx , int error , @ NonNull String filename ) { int res ; switch ( error ) { case DownloadManager . ERROR_CANNOT_RESUME : res = R . string . toast_cannot_resume_download_of ; break ; case DownloadManager . ERROR_DEVICE_NOT_FOUND : res = R . string . toast_device_not_found_for ; break ; case DownloadManager . ERROR_FILE_ALREADY_EXISTS : res = R . string . toast_file_already_exists ; break ; case DownloadManager . ERROR_FILE_ERROR : res = R . string . toast_file_error_for ; break ; case DownloadManager . ERROR_HTTP_DATA_ERROR : res = R . string . toast_http_data_error_for ; break ; case DownloadManager . ERROR_INSUFFICIENT_SPACE : res = R . string . toast_error_insufficient_space_for ; break ; case DownloadManager . ERROR_TOO_MANY_REDIRECTS : res = R . string . toast_error_too_many_redirects_for ; break ; case DownloadManager . ERROR_UNHANDLED_HTTP_CODE : res = R . string . toast_error_too_unhandled_http_code_for ; break ; case DownloadManager . ERROR_UNKNOWN : default : res = R . string . toast_unknown_error_for ; } return ctx . getString ( res , filename ) ; }
Get a human readable error message from the error code
Get a human readable error message from the error code