/** * Starts the download task and sets the listener for a successful download, a failed download, * and configuration strings. */ private void startDownloadTask(final Activity activity) { downloadTask = new DownloadFileTask( activity, urlString, new DownloadFileListener() { public void downloadFailed(DownloadFileTask task, Boolean userWantsRetry) { if (userWantsRetry) { startDownloadTask(activity); } } public void downloadSuccessful(DownloadFileTask task) { // Do nothing as the fragment is already dismissed } public String getStringForResource(int resourceID) { UpdateManagerListener listener = UpdateManager.getLastListener(); if (listener != null) { return listener.getStringForResource(resourceID); } else { return null; } } }); downloadTask.execute(); }