Search code examples
androidandroid-asynctasktoastlooper

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


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?


Solution

  • 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