android 多线程
启动线程
1 Thread thread = new Thread(new AbcThread()); 2 thread.start();
AbcThread 线程类
class LoadLinkDataThread implements Runnable { public void run() { Message msg = handler.obtainMessage(); msg.what = 1; handler.sendMessage(msg); } }
handler处理
1 private Handler handler = new Handler() { 2 public void handleMessage(Message msg) { 3 4 } 5 };
首先启动新线程, 然后再新线程里面处理事务,完成后通知Handler 处理主线程事务。