이 널 (null) 과제의 목적은 무엇인가. connect 메서드에서 BluetoothChatService 클래스 (https://developer.android.com/samples/BluetoothChat/src/com.example.android.bluetoothchat/BluetoothChatService.html)를 찾고 있습니다. - 어쨌든, 단 몇 줄의 나중에 mConnectThread난 그냥 안드로이드 샘플 응용 프로그램 중 하나 분석하고있어 안드로이드 샘플 블루투스 채팅 응용 프로그램
mConnectThread = null;
그것은이 라인은 쓸모없는 것 같다
public synchronized void connect(BluetoothDevice device, boolean secure) {
Log.d("@@@", "connect to: " + device);
// Cancel any thread attempting to make a connection
if (mState == STATE_CONNECTING) {
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
}
}
// Cancel any thread currently running a connection
if (mConnectedThread != null) {
mConnectedThread.cancel();
mConnectedThread = null;
}
// Start the thread to connect with the given device
mConnectThread = new ConnectThread(device, secure);
mConnectThread.start();
setState(STATE_CONNECTING);
}
나는이 라인의 목적이 무엇인가 이해가 안 :이 코드의 같은 부분이 있습니다 새로운 가치로 덮어 씁니다.