java.lang.RuntimeException

Can't create handler inside thread that has not called Looper.prepare()


Samebug tips1

Any worker thread runs in background, since it is not intended to loop, is not connected to a Looper.for example doInBackground(). its implementation returns will be passed to onPostExecute() which runs on the UI thread.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.


Solutions on the web18882

Solution icon of coderanch
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
via GitHub by ntanduc2288
, 1 year ago
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
via GitHub by itvdonsk
, 5 months ago
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
via GitHub by AnmAtAnm
, 7 months ago
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
via GitHub by awadeyar
, 7 months ago
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
Can't create handler inside thread that has not called Looper.prepare()

Stack trace

  • java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() at android.os.Handler.<init>(Handler.java:200) at android.os.Handler.<init>(Handler.java:114) at android.widget.Toast$TN$2.<init>(Toast.java:341) at android.widget.Toast$TN.<init>(Toast.java:341) at android.widget.Toast.<init>(Toast.java:103) at android.widget.Toast.makeText(Toast.java:262) at com.brommko.android.bankalerts.firebase.MyFirebaseInstanceIDService.sendRegistrationToServer(MyFirebaseInstanceIDService.java:46) at com.brommko.android.bankalerts.firebase.MyFirebaseInstanceIDService.onTokenRefresh(MyFirebaseInstanceIDService.java:31) at com.google.firebase.iid.FirebaseInstanceIdService.zza(Unknown Source) at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source) at com.google.firebase.iid.zzb$2.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

14 times, 1 month ago
11 times, 6 months ago
10 times, 8 months ago
2 times, 1 year ago
Once, 1 year ago
36 more bugmates