19

I'm working on an application in Android,and I follow the Codesuggestion from the Android developers page

When I type the code:

private LeDeviceListAdapter mLeDeviceListAdapter;

It has error message:

LeDeviceListAdapter cannot be resolved to a type

What do I have to fix this error??

Falko
  • 17,076
  • 13
  • 60
  • 105
Wun
  • 6,211
  • 11
  • 56
  • 101

2 Answers2

14

The code is actually only extracts of the BTLE sample project inside the Android SDK. You should read the article with the sample project together.

The path of the sample project is /sdk/samples/android-18/legacy/BluetoothLeGatt

If you are only interested in what LeDeviceListAdapter is , here is the code in pastebin

Also I recommend you to read about how AdapterView (ListView's parent) and Adapter works. Nothing to do with the actual BLE work, but you will suffer in understanding the sample code if you don't understand what's happening.

reTs
  • 1,808
  • 1
  • 13
  • 26
  • 3
    It'd be really awesome (er.. i mean helpful at the most basic level) of them to actually share that with the user.... frustrating waste of time to have to figure this out on your own, particularly since in sdk level 19 there is no sample project for BLEGatt. – dudewad Feb 19 '14 at 19:27
  • For API 19 the BLEGatt sample is under /sdk/samples/android-10/connectivity/BluetoothLeGatt – Kevin Jun 06 '14 at 14:53
10

The LeDeviceListAdapter class is not built into the Android APIs; you have to create it yourself. I found the class -- the one that the Android tutorials intended for you to use -- at this link:

https://android.googlesource.com/platform/development/+/7167a054a8027f75025c865322fa84791a9b3bd1/samples/BluetoothLeGatt/src/com/example/bluetooth/le/DeviceScanActivity.java

Just search the page for "LeDeviceListAdapter".

Hunter S
  • 1,293
  • 1
  • 15
  • 26