0
爲什麼Eclipse開發環境會抱怨android Bluetooth Connecting as client ConnectThread example中的private修飾符無效?私人班級可以有公共成員嗎?錯誤消息是:Android藍牙ConnectThread示例錯誤?
非法類修飾符 ConnectThread;只允許公開,抽象, 和final。
private class ConnectThread extends Thread {
private final BluetoothSocket mmSocket;
private final BluetoothDevice mmDevice;
public ConnectThread(BluetoothDevice device) {
BluetoothSocket tmp = null;
mmDevice = device;
try {
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
} catch (IOException e) { }
mmSocket = tmp;
}
public void run() {
mAdapter.cancelDiscovery();
try {
mmSocket.connect();
} catch (IOException connectException) {
try {
mmSocket.close();
} catch (IOException closeException) { }
return;
}
manageConnectedSocket(mmSocket);
}
public void cancel() {
try {
mmSocket.close();
} catch (IOException e) { }
}
}
是的。謝謝。 – jacknad 2011-03-10 21:54:14