title: BluetoothAdapter.getDefaultAdapter(); returns null
body: <p>I'm starting to develop an app to communicate with an arduino device through bluetooth.</p>
  
  <p>I'm initializing the bt adapter with </p>
  
  <pre><code>BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
  </code></pre>
  
  <p>The problem is that btAdapter returns null, </p>
  
  <pre><code>txt_status.append("\nAdapter " + btAdapter);
  </code></pre>
  
  <p>Its like the device hasn't got a bluetooth adapter, which is not my case.</p>
  
  <p>Any ideas? I'm searching around with no luck.</p>
  
  <p>Thanks, Federico</p>
  
  <p>Complete code of the activity:</p>
  
  <pre><code>package com.voice.benz.instaurentremote;
  
  import android.bluetooth.*;
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.Button;
  import android.widget.CompoundButton;
  import android.widget.ListView;
  import android.widget.Switch;
  import android.widget.TextView;
  import android.bluetooth.BluetoothAdapter;
  import android.widget.CompoundButton;
  import android.widget.CompoundButton.OnCheckedChangeListener;
  import android.content.Intent;
  import android.widget.Toast;
  import android.widget.ArrayAdapter;
  import java.util.Set;
  import android.content.Context;
  import android.util.Log;
  public class bluetooth extends ActionBarActivity {
  
  
      private TextView bluetoothPaired;
      private TextView txt_status;
      private BluetoothAdapter btAdapter;
      private ListView listview_devices;
      private Set&lt;BluetoothDevice&gt; dispositivi;
      private ArrayAdapter&lt;String&gt; adapter = null;
      private static final int BLUETOOTH_ON=1000;
  
      private TextView txt_bluetoothStatus;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_bluetooth);
  
          txt_bluetoothStatus = (TextView) findViewById(R.id.txt_bluetooth_status);
          txt_status          = (TextView) findViewById(R.id.txt_status);
  
          listview_devices    = (ListView) findViewById(R.id.listView_devices);
          adapter             = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1);
  
          listview_devices.setAdapter(adapter);
  
  
          BluetoothAdapter btAdapter =  BluetoothAdapter.getDefaultAdapter();
  
  
          if (btAdapter == null)
          {
              System.out.println ("Bluetooth non supportato");
          }
          else
          {
              System.out.println ("Bluetooth inizializzato");
          }
  
          if (btAdapter.isEnabled())
          {
              // Il bluetooth è già attivato
  
              String mydeviceaddress = btAdapter.getAddress();
              String mydevicename = btAdapter.getName();
  
              String status = mydevicename + " : " + mydeviceaddress;
              txt_bluetoothStatus.setText(status);
  
          }
          else
          {
              // Attiva bluetooth
          }
  
  
  
      }
  
      public void attivaBluetooth (View view) {
  
          if (btAdapter != null &amp;&amp; !btAdapter.isEnabled())
          {
              Intent turnOn = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
              startActivityForResult(turnOn, BLUETOOTH_ON);
          }
          //else
              //load();
  
  
      }
  
      public void disattivaBluetooth (View view)
      {
          if (btAdapter.isEnabled())
          {
              btAdapter.disable();
          }
      }
  
      protected void onActivityResult(int requestCode, int resultCode, Intent data)
      {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode==BLUETOOTH_ON &amp;&amp; resultCode==RESULT_OK)
          {
              load();
          }
      }
      private void load()
      {
          dispositivi = btAdapter.getBondedDevices();
          adapter.clear();
          for(BluetoothDevice bt : dispositivi)
              adapter.add(bt.getName());
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_bluetooth, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>