title: How to use LeScanCallback when trying to find BLE-devices?
body: <p>I'm working on an application in Android and I want it to find and list BLE-devices.</p>
  
  <p>There aren't very many topics on it here and I don't get it. I've tried to use the</p>
  
  <pre><code>startLeScan(BluetoothAdapter.LeScanCallback callback);
  </code></pre>
  
  <p>But Eclipse says that LeScanCallback can't be resolved or is not a field (I have the same problem with BluetoothManager and LeDeviceListAdapter). I have all the BT permissions, imported BluetoothGatt, BluetoothGattCallback and have the Samsung SDk jar-file in the right place. What have I missed?</p>
  
  <p>I've used this codesuggestion from the Android developers page (only a part of my code), but I can't get it to work:</p>
  
  <pre><code>public class DeviceScanActivity extends ListActivity {
  
  // Stops scanning after 10 seconds.
  private static final long SCAN_PERIOD = 10000;
  public boolean scanning;
  public BluetoothAdapter aBTAdapter;
  public Handler aHandler;
  
  //------------------------------------------------
  
  private void scanLeDevice(final boolean enable) {
  
      if (enable) {
          // Stops scanning after a pre-defined scan period.
          aHandler.postDelayed(new Runnable() {
              @Override
              public void run() {
                  scanning = false;
                  aBTAdapter.stopLeScan(mLeScanCallback);
              }
          }, SCAN_PERIOD);
  
          scanning = true;
  
          aBTAdapter.startLeScan(mLeScanCallback);
  
      } else {
          scanning = false;
          aBTAdapter.stopLeScan(mLeScanCallback);
      }
  };
  //------------------------------------------
  </code></pre>
  
  <p>}</p>
  
  <p>What do I have to do for Eclipse to recognize BluetoothManager, LeDeviceListAdapter and LeScanCallback?
  How do I introduce the mLeScanCallback-variable?</p>
  
  <p>Any help would be greatly appreciated! I'm sort of new to programming so pedagogical answers please.</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>I have tried this code to declare the callback but it doesn't work, gives me the same error as mentioned above (BluetoothAdapter.LeScanCallback can't be resolved or is not a field):</p>
  
  <pre><code>private LeDeviceListAdapter mLeDeviceListAdapter;
  
  // Device scan callback.
  private BluetoothAdapter.LeScanCallback mLeScanCallback =
          new BluetoothAdapter.LeScanCallback() {
      @Override
      public void onLeScan(final BluetoothDevice device, int rssi,
              byte[] scanRecord) {
          runOnUiThread(new Runnable() {
             @Override
             public void run() {
                 mLeDeviceListAdapter.addDevice(device);
                 mLeDeviceListAdapter.notifyDataSetChanged();
             }
         });
     }
  };
  </code></pre>
  
  <p>Also, errors --> can't run it --> no log</p>