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

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

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

 

posted @ 2018-07-19 16:00  adyyzjb  阅读(559)  评论(0编辑  收藏  举报