莫名其妙的报错
错误原因是不在主线程调用了弹窗方法
解决方法很简单
创建Handler
static final int REFRESH_COMPLETE = 0X1112;
private Handler mHandler = new Handler() {public void handleMessage(android.os.Message msg) {switch (msg.what) {case REFRESH_COMPLETE:ObServernotice.getInstance().notifyObserver(211,1,"",null);
//todo...在这里调用弹窗break;}}};
子线程调用mHandler
if (MainActivity.this instanceof Activity) {if ( (MainActivity.this).isFinishing()) {return ;} }
mHandler.sendEmptyMessageDelayed(REFRESH_COMPLETE, 1000);