okhhtp异步请求是发生在子线程的,如果用子线程来更改UI肯定是不行的,这是Google规定:更改UI必须在主线程,也就是UI线程中才可以。在子进程中显示toast,必须使用Google提供的Handler来解决这个问题。
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(ReleaseNotice.this,
"要显示的内容",Toast.LENGTH_SHORT).show();
}
});