class MyThread extends Thread { private Handler handler; //public Looper looper; @Override public void run() { // 创建一个looper Looper.prepare(); //looper=Looper.myLooper(); handler = new Handler() { @Override public void handleMessage(Message msg) { System.out.println("currentThread--------->" + Thread.currentThread()); }; }; Looper.loop(); } }
相关分类