Toast只能在UI线程弹出,解决此问题可以在Toast前后加两行代码,如下所示:

       Looper.prepare();
Toast.makeText(getApplicationContext(),"操作失败:"+r.Message,Toast.LENGTH_LONG).show();
Looper.loop();

android Toast提示异常:java.lang.RuntimeException: Can't create handler inside thread that has not called的更多相关文章

  1. 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.pre ...

  2. java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

  3. Android-java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

    章出自:luchg技术交流 http://www.luchg.com 版权所有.本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源,谢谢. Android-java.lang.Runti ...

  4. Android进阶(十六)子线程调用Toast报Can't create handler inside thread that has not called Looper.prepare() 错误

    原子线程调用Toast报Can't create handler inside thread that has not called Looper.prepare() 错误 今天用子线程调Toast报 ...

  5. Android 线程更新UI报错 : Can't create handler inside thread that has not called Looper.prepare()

    MainActivity中有一个按钮,绑定了save方法 public void save(View view) { String title = titleText.getText().toStri ...

  6. Android Exception 13(Can't create handler inside thread that has not called Looper.prepare())

    10-12 17:02:55.500: E/AndroidRuntime(28343): FATAL EXCEPTION: Timer-2 10-12 17:02:55.500: E/AndroidR ...

  7. Android handler 报错处理Can't create handler inside thread that has not called Looper.prepare()

    问题: 写了一个sdk给其他人用,提供一个回调函数,函数使用了handler处理消息 // handler监听网络请求,完成后操作回调函数 final Handler trigerGfHandler ...

  8. uiatuomator提示shortMsg=java.lang.RuntimeException

    自动化要做断言,原本打算使用的testng,因为它断言后就能出结果,还能生成报告,但是在实践过程中,硬是没有成功,所以还是放弃,使用的junit,后面使用的cts框架生成的邮件,现在记录使用junit ...

  9. Storm 执行异常 java.lang.RuntimeException: java.nio.channels.UnresolvedAddressException 问题解决

    最近写的 binlog2kafka storm job 上线在一个新的集群环境中(storm 0.9.0.1, kafka 0.8), storm job 运行时报出如下异常: java.lang.R ...

随机推荐

  1. 20140702 赋值构造函数的形参为什么一定用引用。string类的赋值运算函数的注意点

    1.复制构造函数为什么一定要用引用,而不是用值 类名::复制构造函数(类名&引用名) 传递引用,可以避免复制,如果一个数据相当大的化,进行复制会浪费很多时间的. 类名::复制构造函数(类名 变 ...

  2. testNG官方文档翻译-3 testng.xml

    你可以通过以下几种不同的方法触发TestNG: 用一个testng.xml文件 使用ant 从命令行触发 这个章节将会介绍testng.xml的格式(你也可以在下面找到关于ant和命令行的内容). 关 ...

  3. wordpress 上传图片时提示“无法建立目录wp-content/uploads/2019/03。有没有上级目录的写权限?”

    查一下网站目录下wp-content目录的权限, # ls -l drwxr-xr-x  5 nobody 65534  4096 Feb  3  2016 wp-content 修改wp-conte ...

  4. Selenium3 + Python3自动化测试系列八——警告框处理和下拉框选择

    警告框处理 在WebDriver中处理JavaScript所生成的alert.confirm以及prompt十分简单,具体做法是使用 switch_to.alert 方法定位到 alert/confi ...

  5. el-scrollbar 如何去掉横线滚动条?

    1. el-scrollbar style="height:100%" 2. 不要在scoped私有变量添加 .el-scrollbar__wrap{ overflow-x: hi ...

  6. 《提高c++性能的编程技术》读书笔记

    一个程序的执行效率是取决于改程序翻译成汇编语言之后的执行的机器指令的条数.而每一个机器指令的执行的周期是一定的.C语言和C++都是高于汇编语言的高级语言,其中,C语言源代码与其相应的机器指不是完全同一 ...

  7. MySQL高可用配置(主从复制)

    主从复制包含两个步骤: 在 master 主服务器(组)上的设置,以及在 slave 从属服务器(组)上的设置. 环境: MASTER: 192.168.155.101SLAVE: 192.168.1 ...

  8. 夯实JavaScript基础之prototype, __proto__, instanceof

    function New(f){ return function(){ var o = {'__proto__': f.prototype}; f.apply(o, arguments); retur ...

  9. Python全栈开发:Javascript

    JavaScript是一门编程语言,浏览器内置了JavaScript语言的解释器,所以在浏览器上按照JavaScript语言的规则编写相应代码之,浏览器可以解释并做出相应的处理. 一.如何编写 1.J ...

  10. TPCx-BB官宣最新世界纪录,阿里巴巴计算力持续突破

    2019年9月17日,TPC官宣Alibaba Cloud MaxCompute认证结果.同月26日,杭州云栖大会阿里巴巴宣布了这一成绩,飞天大数据平台计算引擎MaxCompute成为全球首个TPCx ...