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?

bemeyer
  • 6,154
  • 4
  • 36
  • 86
Jacob
  • 14,949
  • 19
  • 51
  • 74
  • 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,876
  • 2
  • 22
  • 33