How to raise a toast in AsyncTask, I am prompted to used the Looper

Pentium10 picture Pentium10 · May 14, 2010 · Viewed 50.1k times · Source

I have tasks completed by AsyncTask in background. At some point I need to issue a Toast that something is completed.

I've tried and I failed because Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

How can I do that?

Answer

Alex Volovoy picture Alex Volovoy · May 14, 2010

onPostExecute - executes on UI thread or publishProgress(); in your doinbackground and

protected void onProgressUpdate(Integer... progress) {
}

http://developer.android.com/reference/android/os/AsyncTask.html