private final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_CONNECT_DEVICE_SUCCESSFULLY:
closeProgress();
Toast.makeText(getApplicationContext(), "连接设备成功",
Toast.LENGTH_SHORT).show();
Log.i(TAG, "连接设备成功");
Intent intent = new Intent();
intent.setClass(LlsMainActivity.this, LlsConfigActivity.class);
intent.putExtra("name", msg.getData().getString("deviceName"));
if (phoneMacAddress != null) {
intent.putExtra("phoneMac", phoneMacAddress);
}
startActivityForResult(intent, 0x7712);
break;
case MESSAGE_CONNECT_DEVICE_FAILED:
closeProgress();
Toast.makeText(getApplicationContext(), "连接设备失败",
Toast.LENGTH_SHORT).show();
Log.i(TAG, "连接设备失败");
break;
default:
break;
}
super.handleMessage(msg);
}
};
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_CONNECT_DEVICE_SUCCESSFULLY:
closeProgress();
Toast.makeText(getApplicationContext(), "连接设备成功",
Toast.LENGTH_SHORT).show();
Log.i(TAG, "连接设备成功");
Intent intent = new Intent();
intent.setClass(LlsMainActivity.this, LlsConfigActivity.class);
intent.putExtra("name", msg.getData().getString("deviceName"));
if (phoneMacAddress != null) {
intent.putExtra("phoneMac", phoneMacAddress);
}
startActivityForResult(intent, 0x7712);
break;
case MESSAGE_CONNECT_DEVICE_FAILED:
closeProgress();
Toast.makeText(getApplicationContext(), "连接设备失败",
Toast.LENGTH_SHORT).show();
Log.i(TAG, "连接设备失败");
break;
default:
break;
}
super.handleMessage(msg);
}
};