首次启动时无法创建处理程序应用程序崩溃

时间:2017-05-16 20:06:44

标签: java android webview

使用webview应用程序模板一切都很好,但只是应用程序在第一次启动时一直崩溃,我无法通过java错误创建处理程序,如果有人可以请帮助我



FATAL EXCEPTION: pool-4-thread-1
Process: com.brommko.android.tasweqo, PID: 9676
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:345)
	at android.widget.Toast.<init>(Toast.java:101)
	at android.widget.Toast.makeText(Toast.java:259)
	at com.brommko.android.tasweqo.firebase.MyFirebaseInstanceIDService.sendRegistrationToServer(MyFirebaseInstanceIDService.java:46)
	at com.brommko.android.tasweqo.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:1113)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
	at java.lang.Thread.run(Thread.java:818)
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

at com.brommko.android.tasweqo.firebase.MyFirebaseInstanceIDService.sendRegistrationToServer(MyFirebaseInstanceIDService.java:46)

可以在子线程中更新页面的操作,android.widget.Toast.makeText(Toast.java:259)