use of org.pixmob.httpclient.demo.TaskExecutionFailedException in project httpclient by pixmob.
the class DownloadFileTask method doRun.
@Override
protected void doRun() throws Exception {
final File imgFile = new File(getContext().getCacheDir(), "google_logo.png");
imgFile.delete();
final HttpClient hc = createClient();
hc.get("http://www.google.fr/images/srpr/logo3w.png").to(imgFile).execute();
if (!imgFile.exists() || imgFile.length() == 0) {
throw new TaskExecutionFailedException("File download failed");
}
}
Aggregations