handler使用方法
// 听说这是最标准的写法 MyHandler myHandler = new MyHandler(this); static class MyHandler extends Handler{ WeakReference weakReference; public MyHandler(MainActivity activity){ weakReference=new WeakReference(activity); } @Override public void handleMessage(Message msg) { switch (msg.what){ case REFRESLAYOUT: LogUtil.e("10s打印一次"); sendEmptyMessageDelayed(REFRESLAYOUT, 10000); break; } } }
参照的以下网址 https://blog.csdn.net/androidsj/article/details/79865091
最简单的教养,就是适当地回避别人的难堪。