一、发送Message消息
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
}
};
private Handler handler = new Handler(Looper.myLooper()){
@Override
public void handleMessage(Message msg) {
}
};
private Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
return false;
}
});
private Handler handler = new Handler(Looper.myLooper(),new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
return false;
}
});
//发送Message消息
Message message = Message.obtain();
message.what = 1;
message.obj = "result";
handler.sendMessage(message);
//发送Runnable对象
Runnable runnable = new Runnable() {
@Override
public void run() {
}
};
handler.post(runnable);