标签:
直接上代码:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); HandlerThread hThread=new HandlerThread("myThread"); hThread.start(); myhandler myhandler=new myhandler(hThread.getLooper()); Message msg=myhandler.obtainMessage(); msg.sendToTarget();//把 Message发送到目标对象,目标对象就是生成msg的目标对象。 } class myhandler extends Handler{ public myhandler(Looper looper){ super(looper); } public void handleMessage(Message msg) { Log.e("这是新线程", "》》》》》》》》》》》》》》》》》新线程的测试"); } }
标签:
原文地址:http://www.cnblogs.com/chengzhengfu/p/4578959.html