title: How to use toast message inside Thread in Android
body: <p>I am facing some problems when I'm using Toast inside run method of Thread class.</p>
  
  <p>My error Logcat</p>
  
  <pre><code>09-16 11:42:38.140: E/AndroidRuntime(1446): in writeCrashedAppName, pkgName :com.monday.worker_android
  09-16 11:59:17.920: E/AndroidRuntime(2144): FATAL EXCEPTION: AsyncTask #1
  09-16 11:59:17.920: E/AndroidRuntime(2144): java.lang.RuntimeException: An error occured while executing doInBackground()
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at android.os.AsyncTask$3.done(AsyncTask.java:200)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at java.lang.Thread.run(Thread.java:1019)
  09-16 11:59:17.920: E/AndroidRuntime(2144): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at android.os.Handler.&lt;init&gt;(Handler.java:121)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at android.widget.Toast.&lt;init&gt;(Toast.java:75)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at android.widget.Toast.makeText(Toast.java:244)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at com.monday.worker_android.SwipePage$2.doInBackground(SwipePage.java:142)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at com.monday.worker_android.SwipePage$2.doInBackground(SwipePage.java:1)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
  09-16 11:59:17.920: E/AndroidRuntime(2144):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
  </code></pre>
  
  <p>But when I ignore Toast it works fine. But I want to use it. Please help.</p>