我正在关注一个关于 Android 中蓝牙的示例。当按照示例并尝试理解该过程时,我收到一个错误:“返回类型与 Thread.getState() 不兼容”。是什么导致此错误,我该如何解决?
以下是相关代码:
private int mState;
/**
* Set the current state of the chat connection
* @param state An integer defining the current connection state
*/
private synchronized void setState(int state) {
if (D) Log.d(TAG, "setState() " + mState + " -> " + state);
mState = state;
// Give the new state to the Handler so the UI Activity can update
mHandler.obtainMessage(Rc_auto.MESSAGE_STATE_CHANGE, state, -1).sendToTarget();
}
/**
* Return the current connection state. */
public synchronized int getState() {
return mState;
}
//How it's called
public synchronized void start() {
setState(STATE_LISTEN);
}