When I use this code, event onFailure executes every time with message: "Can't create handler inside thread that has not called Looper.prepare()"
What's the problem? Thanks.
1 Comment
E
Edward
said
about 7 years ago
The library uses Android's `AsyncTask` class to make network requests. These requests must be made on the main thread, or you will see that above error message.
If you need to call these methods from a different background thread (or another `AsyncTask`), you can call:
Looper.prepare()
in your thread before using the library. Take a look here for more information: http://stackoverflow.com/questions/3875184/cant-create-handler-inside-thread-that-has-not-called-looper-prepare
Веталь Маркус
FileMetaData myMetaData = new FileMetaData("518fb003a6b1878c340040c8");
FileOutputStream myOutputStream = null;
try {
myOutputStream = new FileOutputStream(new File(Environment.getExternalStorageDirectory(),"QWERTYUI"));
} catch (FileNotFoundException e) { }
client.file().download(myMetaData, myOutputStream, new DownloaderProgressListener()
{
@Override
public void onSuccess(Void arg0) {
Toast.makeText(getApplicationContext(), "DOWNLOAD_FIMISHED", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(Throwable arg0) {
Toast.makeText(getApplicationContext(), arg0.getLocalizedMessage(), Toast.LENGTH_SHORT).show();
}
@Override
public void progressChanged(MediaHttpDownloader arg0) throws IOException {
Toast.makeText(getApplicationContext(), "SOMETHING_CHANGED", Toast.LENGTH_SHORT).show();
}
});
======================
When I use this code, event onFailure executes every time with message: "Can't create handler inside thread that has not called Looper.prepare()"
What's the problem? Thanks.