android handler 用sendMessage()发送消息后没有反应
我自己重写的Handler类mHandlerhandler,然后在一个newThread()中执行:Messagemsg=Message.obtain();Log.i("...
我自己重写的Handler类 mHandler handler,然后在一个new Thread()中执行:
Message msg = Message.obtain();
Log.i("TAG","Thread1 - msg");
msg.what = 2;
handler.sendMessage(msg);
然后线程中的Log能打印出来,但是在Handler中重写的
public void handleMessage(Message msg) {
Log.i("TAG","handler is running");
switch(msg.what){
case 1:……
就打印不出来,
求解…… 展开
Message msg = Message.obtain();
Log.i("TAG","Thread1 - msg");
msg.what = 2;
handler.sendMessage(msg);
然后线程中的Log能打印出来,但是在Handler中重写的
public void handleMessage(Message msg) {
Log.i("TAG","handler is running");
switch(msg.what){
case 1:……
就打印不出来,
求解…… 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询