android 线程间的通信
2010-08-23 01:12:00 来源:WEB开发网核心提示:087 toMain.obj = "This is " + this.getLooper().getThread().getName() +088 ". Did you send me \"" + (String)msg.obj + "\"?&quo
087 toMain.obj = "This is " + this.getLooper().getThread().getName() +
088 ". Did you send me \"" + (String)msg.obj + "\"?";
089
090 mMainHandler.sendMessage(toMain);
091
092 Log.i(CHILD_TAG, "Send a message to the main thread - " + (String)toMain.obj);
093
094 } catch (InterruptedException e) {
095 // TODO Auto-generated catch block
096 e.printStackTrace();
097 }
098 }
099
100 };
101
102 Log.i(CHILD_TAG, "Child handler is bound to - "+ mChildHandler.getLooper().getThread().getName());
103
104 //启动子线程消息循环队列
105 Looper.loop();
106 }
107 }
108}
更多精彩
赞助商链接