//启动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());
}
}
};
最后
以上就是秀丽大碗最近收集整理的关于android 多线程 闪退,android 有关线程和Handler的问题,一起动线程APP就闪退!的全部内容,更多相关android内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复