//启动thread try{ this._socket.connect(); Toast.makeText(this, "连接" + this._device.getName() + "成功!", 0).show(); this.ReadThread.start(); } catch (IOException localIOException4) { Toast.makeText(this, "接收数据失败!", 0).show(); //return; }
//这是Thread
Thread ReadThread = new Thread() {
public void run() {
Message msg=new Message();
msg.obj="123";
msg.what=1;
handler.sendMessage(msg);
}
}
//这是Handler
private Handler handler =new Handler() {
@Override
public void handleMessage(Message msg) {
if(msg.what==1){
BTClient bt =new BTClient();
bt.tv.setText("123");
// bt.sv.scrollTo(0, bt.dis.getMeasuredHeight());
}
}
};
hitman
相关分类