문제

I'm using BluetoothAdapter in android studio 0.4. Project api minSdkVersion 11.

Main activity look as follows:

public class MainActivity extends Activity {

    private BluetoothAdapter bluetoothAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        bluetoothAdapter = new BluetoothAdapter.getDefaultAdapter();
    }
}

The getDefaultAdapter causes: Cannot resolve symbol 'getDefaultAdapter()'.

Any ideas?

도움이 되었습니까?

해결책

it seems you should change this

bluetoothAdapter = new BluetoothAdapter.getDefaultAdapter();

to

bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

as the method is a static method.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top