我是靠谱客的博主 怕黑眼睛,这篇文章主要介绍Android 中异常:Can‘t toast on a thread that has not called Looper.prepare(),现在分享给大家,希望可以做个参考。
Android 中异常:Can’t toast on a thread that has not called Looper.prepare()
1.原因:子线程直接弹Toast
2.解决:
Looper.prepare();
Toast.makeText(MainActivity.this, "信息", Toast.LENGTH_SHORT).show();
Looper.loop();
最后
以上就是怕黑眼睛最近收集整理的关于Android 中异常:Can‘t toast on a thread that has not called Looper.prepare()的全部内容,更多相关Android内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复