Reputation: 7963
I tried to connect with my target device using Bluetooth GATT service, I got this message in console and can't connect.
I tried to connect by using this,
bluetoothGatt = mDiscoverderDevice.connectGatt(this, true, mGattCallback);
D/BluetoothGatt: connect() - device: 5D:BB:1E:F0:09:05, auto: true
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=b6173656-60d1-494d-bac2-dc1f1a12f294
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=6
D/ALERT **** :: connectwithGATTServiceandroid.bluetooth.BluetoothGatt@20128b49
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=5D:BB:1E:F0:09:05
W/BluetoothGatt: Unhandled exception in callback
W/BluetoothGatt: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
W/BluetoothGatt: at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6462)
W/BluetoothGatt: at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:897)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:360)
W/BluetoothGatt: at android.view.View.requestLayout(View.java:17494)
W/BluetoothGatt: at android.widget.TextView.checkForRelayout(TextView.java:6880)
W/BluetoothGatt: at android.widget.TextView.setText(TextView.java:4063)
W/BluetoothGatt: at android.widget.TextView.setText(TextView.java:3921)
W/BluetoothGatt: at android.widget.TextView.setText(TextView.java:3896)
W/BluetoothGatt: at tel.android.com.rseremote.MainActivity.setStatus(MainActivity.java:293)
W/BluetoothGatt: at tel.android.com.rseremote.MainActivity.access$500(MainActivity.java:37)
W/BluetoothGatt: at tel.android.com.rseremote.MainActivity$5.onConnectionStateChange(MainActivity.java:381)
W/BluetoothGatt: at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:181)
W/BluetoothGatt: at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:70)
W/BluetoothGatt: at android.os.Binder.execTransact(Binder.java:446)
Upvotes: 0
Views: 551
Reputation: 1379
I think it is not related to BLE.
you are trying to update a view element like Toast or a TexetView from outside thread.
thats why it says
Only the original thread that created a view hierarchy can touch its views
Try using runOnUIThread Method to update the UI Views.
Upvotes: 1