조각 내에서 Bluetooth 연결의 상태를 알려주기 위해 TextView를 변경하려하지만 msgReceived.setText(string)
이 호출 될 때 아무 것도 일어나지 않는 것 같습니다. 이 일을 어떻게 하죠?동일한 활동의 조각 내 TextView 텍스트를 변경할 수 없습니다.
dleedesign.dubcommunicationstestapp D/BluetoothService: Bounded device 40:EF:4C:C2:A9:32
dleedesign.dubcommunicationstestapp D/BluetoothService: Bounded device 98:D3:31:70:80:C5
dleedesign.dubcommunicationstestapp D/BluetoothService: start
dleedesign.dubcommunicationstestapp D/BluetoothService: setState() 0 -> 1
dleedesign.dubcommunicationstestapp W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
dleedesign.dubcommunicationstestapp D/BluetoothService: Socket Type: nullBEGIN mAcceptThreadThread[Thread-20627,5,main]
dleedesign.dubcommunicationstestapp D/BluetoothService: connect to: 98:D3:31:70:80:C5
dleedesign.dubcommunicationstestapp D/BluetoothService: setState() 1 -> 2
dleedesign.dubcommunicationstestapp D/Main: Btservice started- listening
dleedesign.dubcommunicationstestapp I/BluetoothService: BEGIN mConnectThread SocketType:null
dleedesign.dubcommunicationstestapp W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback
dleedesign.dubcommunicationstestapp D/Main: MESSAGE_STATE_CHANGE: 1
dleedesign.dubcommunicationstestapp D/Main: MESSAGE_STATE_CHANGE: 2
dleedesign.dubcommunicationstestapp E/BluetoothService: Unable to connect socket
java.io.IOException: read failed, socket might closed or timeout, read ret: -1
at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:517)
at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:528)
at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:320)
at dleedesign.dubcommunicationstestapp.Bluetooth$ConnectThread.run(Bluetooth.java:408)
dleedesign.dubcommunicationstestapp D/BluetoothService: start
dleedesign.dubcommunicationstestapp D/BluetoothService: setState() 2 -> 1
dleedesign.dubcommunicationstestapp D/Main: MESSAGE_TOAST { when=-15ms what=5 target=dleedesign.dubcommunicationstestapp.SecondFragment$1 }
dleedesign.dubcommunicationstestapp D/Main: MESSAGE_STATE_CHANGE: 1
은 무엇입니까 (버튼 사용하려고하는 등 다른 텍스트 뷰와 동일)
, 레이아웃을 팽창한다 네가 본 메시지? 또한 logcat 스 니펫이 유용 할 수 있습니다. IMHO 다른 스레드에서 블루투스를 사용하고 UI 스레드에 정보를 표시하려면 'AsyncTask'와 같은 것을 사용해야합니다. –더 효율적인 방법이 되겠습니까? –