[SOLVED] Can’t toast on a thread that has not called looper.prepare()

13Aug, 2018

This particular error occurs mainly when working with threads in an Android project.   So straight to the point, no stories.


I’m not going to go into all the technicalities of threading, what this error simply means is that you are trying to manipulate or show a User Interface component from a non-UI thread.   A simple example:

Running the above code will result in the “Can’t create handler inside thread that has not called Looper.prepare()” error.


  1. Use activity.runOnUiThread():   When manipulating or showing a UI component from a non UI Thread, simply use the runOnUiThread() method.   For example:
  2. Use Looper:   Here’s another very simple solution:

There are many other solutions but I personally find these 2 very easy to implement.



This StackOverflow question thought me a lot about this Android Error:

Feel free to ask any questions or contribute to this post in the comment section below.

1 Comment

  • Ronald May 3, 2019 @ 8:24 am

    I love the way you described the cause of this Error.
    The first solution worked for me

Leave a Reply

Your email address will not be published. Required fields are marked *