2

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?

BennX
  • 6,164
  • 3
  • 35
  • 84
Jacob
  • 14,341
  • 18
  • 50
  • 70
  • This may possibly be relevant (they did a clean of the project in the answer): http://stackoverflow.com/questions/17054000/cannot-resolve-symbol-r-android-studio – CodeChimp Feb 20 '14 at 19:30

1 Answers1

4

it seems you should change this

bluetoothAdapter = new BluetoothAdapter.getDefaultAdapter();

to

bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

as the method is a static method.

Sanjeev
  • 9,798
  • 2
  • 20
  • 33