Can't toast on a thread that has not called Looper.prepare()
这个错误说了就是子线程直接弹Toast
就说下我的处理方法
Looper.prepare();Toast.makeText(MainActivity.this, "11111", Toast.LENGTH_SHORT).show();Looper.loop();
这样就可了,
Can't toast on a thread that has not called Looper.prepare()相关推荐
- Android在子线程里使用Toast报错Can't toast on a thread that has not called Looper.prepare()
在接android SDK的时候有时候为了方便debug调试查看,通过Toast输出相关信息, 实际上这个是在子线程中输出的,在logcat里查看有如下报错java.lang.RuntimeExcep ...
- Can't create handler inside thread that has not called Looper.prepare()
问题: Can't create handler inside thread that has not called Looper.prepare() 1,在报错的方法前加Looper.prepare ...
- java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() ...
- Can't create handler inside thread that has not called Looper.prepare() 解决办法
在开发的过程当中,遇到了想在一个线程中弹出一个提示窗 new AlertDialog.Builder( context),但是就出现了一个问题. java.lang.Runtim ...
- Can't create handler inside thread Thread that has not called Looper.prepare()
今天在子线程里面写了一个Toast 运行程序直接崩溃了 看了下log 如下 最后忽然想到了子线程里面不能直接使用Toast 然后 就添加了 Looper.prepare(); 和 Looper.loo ...
- 【Android】java.lang.AssertionError use looper thread, must call Looper.prepare() first!异常分析
java.lang.AssertionError: use looper thread, must call Looper.prepare() first! 在消息处理中必须先调用Looper类的pr ...
- Android进阶:六、在子线程中直接使用 Toast 及其原理
最近因为个人原因,很久没有更文章,感谢关注的小伙伴,望谅解! 一般我们都把Toast当做一个UI控件在主线程显示.但是有时候非想在子线程中显示Toast,就会使用Handler切换到主线程显示. 但是 ...
- Android 9.0 Toast源码改变引发的问题
问题描述 在Android开发中,Toast的重复显示问题很早就有人提出了解决方案,具体做法就是全局使用一个Toast对象,就像下面这样: private static Toast mToast = ...
- 小小的Toast蕴含大道理(解决关闭通知时原生Toast不显示问题)
目录 一.Toast成员变量 二. Toast显示流程 1. Toast makeText(@NonNull Context context, @Nullable Looper looper,@Non ...
最新文章
- Android studio 不显示自定义View 的提示
- c语言变量作用域生命周期,C/C++——C++变量的作用域与生命周期,C语言中变量的作用域和生命周期...
- ORACLE数据库基本操作命令
- python可视化神器_详解Python可视化神器Yellowbrick使用
- 【技术累积】【点】【java】【27】@JSONField
- python时间函数报错_Python Day11-LEGB-global-时间函数
- 16.对极几何——极线约束,收敛相机,平行图像平面,两个立体对 测验_2
- 数据库中的年月日表达
- 浏览器 pad android,360安全浏览器平板电脑Pad专用版-360安全浏览器HD 安卓版v1.1.0-PC6安卓网...
- 51单片机数码管闪烁c语言,AT89C51单片机数码管闪烁问题怎么解决
- 开源GIS-01-开源库的编译
- 3.3计算机网络(ALOHA协议 CSMA协议 令牌传递协议 频分时分波分码分)
- 已经买好了域名后怎么建立一个网站
- [论文阅读]PIXER: an automated particle-selection method based on segmentation using deep neural network
- kafka安装部署和使用
- MATLAB学习——低通滤波(频域滤波(一))
- 2023年浙江工业大学MPA提前批招生通知
- 机器学习(18)——分类算法(补充)
- rutracker网站无法进入,解决方案来啦
- 成都IT云图:安逸生活撞上十倍速度
热门文章
- 2019年终总结:好好爱自己
- 【C#实践】三层:初识
- 重型车辆盲区行为检查Behaviours – Heavy Vehicle Blind Spots
- 如何写新的Python OP
- ONNX 实时graph优化方法
- 软件定义汽车:本质并行化的有效平台
- 2020年Yann Lecun深度学习笔记(上)
- AlexeyAB DarkNet YOLOv3框架解析与应用实践(六)
- 2021年大数据基础(三):​​​​​​​​​​​​​​​​​​​​​大数据应用场景
- Java IDEA Debug进制二维数组