如果你启动了一个线程,比如去扫描蓝牙设备列表,扫描了以后,然后想去更新,你的android的UI
这个时候就会报错,说你必须在你的UI线程中,去更新你的UI,这个时候,你可以,先用一个线程去扫描蓝牙设备,
得到蓝牙设备列表以后,然后给一个Handler去发送消息,把列表,发过去就可以.
//搜索蓝牙设备按钮
//String[] items3 = new String[]{"测试1", "测试2", "测试3", "测试4"};//创建item
final String[] items3 = (String[]) macLists.toArray(new String[macLists.size()]);//创建item
new Thread(){
@Override
public void run() {
Looper.prepare();
AlertDialog alertDialog3 = new AlertDialog.Builder(SettingActivity.this)
.setTitle("扫描设备列表:")
.setIco