This commit is contained in:
Jay
2017-08-15 11:59:00 +08:00
parent 1baa779c49
commit 95c4bdaa9d
3 changed files with 12 additions and 15 deletions
@@ -30,22 +30,18 @@ class MainActivity : Activity() {
ble?.startScan()
}
th = Thread(Runnable { ->
{}.run {
thrun = true
while (thrun) {
System.out.println("state ===== " + ble?.mState)
if (ble?.mState == ble?.CONNECTED) {
uiHandler.post {
run {
btn.isEnabled = true
}
}
thrun = false
break
th = Thread(Runnable {
thrun = true
while (thrun) {
System.out.println("state ===== " + ble?.mState)
if (ble?.mState == ble?.CONNECTED) {
uiHandler.post {
btn.isEnabled = true
}
Thread.sleep(200)
thrun = false
break
}
Thread.sleep(200)
}
})
th?.start()