0

Bluetooth chat sample error1

error2

Hi I trying out the bluetooth chat but I getting this error cannot resolve method start(); for both. Anyone know what wrong?

BluetoothData_display Java file Bluetooth Service Java

So The BluetoothService.start() error I getting is in this Bluetooth Service java link and the mchatservice error is in this BluetoothData_display Java link. I using the Bluetooth chat sample code and I changed some of the code in it.

Spotty
  • 197
  • 2
  • 2
  • 14

1 Answers1

0

I have gone through the code sample you have mentioned above , I found that you have not defined start() (It is included in BluetoothChatService of sample code) method inside BluetoothService (Which you have uploaded on dropbox)

Here is the start() method of BluetoothChatService .Modify it according to yours.

public synchronized void start() {
    Log.d(TAG, "start");

    // Cancel any thread attempting to make a connection
    if (mConnectThread != null) {
        mConnectThread.cancel();
        mConnectThread = null;
    }

    // Cancel any thread currently running a connection
    if (mConnectedThread != null) {
        mConnectedThread.cancel();
        mConnectedThread = null;
    }

    setState(STATE_LISTEN);

    // Start the thread to listen on a BluetoothServerSocket
    if (mSecureAcceptThread == null) {
        mSecureAcceptThread = new AcceptThread(true);
        mSecureAcceptThread.start();
    }
    if (mInsecureAcceptThread == null) {
        mInsecureAcceptThread = new AcceptThread(false);
        mInsecureAcceptThread.start();
    }
}
Shishupal Shakya
  • 1,632
  • 2
  • 18
  • 41