Android 常见错误之 Can't create handler inside thread that has not called Looper.prepare()

Can’t create handler inside thread that has not called Looper.prepare() 是 Android 开发中比较常见的错误之一,遇到这种错误,通常情况下,我们会根据提示信息来进行 Looper.prepare(),其实大可不必

错误发生原因:通常情况都是我们在子线程中更新 UI 所致。

解决办法:把更新 UI 的操作交给 Handler 即可。

文章有帮助到您?不妨打赏博主一碗拉面或一杯咖啡的小费吧 :-D!