new Thread(new Runnable() { @Override public void run() { Message message; String obj = "OK"; message = handler.obtainMessage(1, obj); handler.sendMessage(message); } }).start();依不同message做後續處理
private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); String MsgString = (String) msg.obj; if (MsgString.equals("OK")) { //do something } } };
沒有留言:
張貼留言