线程中使用Toast空指针异常
作者:互联网
java.lang.NullPointerException: Can't toast on a thread that has not called Looper.prepare()
线程不存在消息循环,需要在子线程中手动创建一个Looper
Looper.prepare();
Toast.makeText(MainActivity.this,“提示信息”,Toast.LENGTH_SHORT).show();
Looper.loop();
标签:Toast,prepare,show,线程,Looper,提示信息,指针 来源: https://www.cnblogs.com/ytsja/p/16341361.html