android Toast提示异常:java.lang.RuntimeException: Can't create handler inside thread that has not called

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

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

 

posted @   adyyzjb  阅读(585)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示