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.


,
via vogella.com by Unknown author

Solutions on the web402

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

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

Solution icon of github
via GitHub by danfoster
, 1 year ago
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
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
via GitHub by sarahlensing
, 11 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
via GitHub by c-h-
, 1 month ago
Can't create handler inside thread that has not called Looper.prepare()

Solution icon of github
via GitHub by WooYu
, 5 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()

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.<init>(Toast.java:348)
	at android.widget.Toast.<init>(Toast.java:104)
	at android.widget.Toast.makeText(Toast.java:262)
	at android.widget.Toast.makeText(Toast.java:289)
	at de.qabel.qabelbox.startup.fragments.CreateAccountResetPasswordFragment$1.onError(CreateAccountResetPasswordFragment.java:109)
	at de.qabel.qabelbox.communication.callbacks.RequestCallback.onResponse(RequestCallback.java:55)
	at okhttp3.RealCall$AsyncCall.execute(RealCall.java:126)
	at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
	at java.lang.Thread.run(Thread.java:818)

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, 3 months ago
11 times, 8 months ago
10 times, 10 months ago
2 times, 1 year ago
Once, 1 year ago
37 more bugmates