can help guide me to solve this issue?
——————————————-ERROR ———————————————————-
`> Caused by: java.lang.NullPointerException: Attempt to invoke virtual method ‘void com.example.android.bluetoothlegatt.DeviceScanActivity$LeDeviceListAdapter.clear()’ on a null object reference
at com.example.android.bluetoothlegatt.DeviceScanActivity.onPause(DeviceScanActivity.java:175)
`
———————————–DeviceScanActivity————————————————————–
`@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
User chose not to enable Bluetooth.
if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
finish();
return;
}
super.onActivityResult(requestCode, resultCode, data);
}@Override
protected void onPause() {
super.onPause();
scanLeDevice(false);
mLeDeviceListAdapter.clear();
}@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
final BluetoothDevice device = mLeDeviceListAdapter.getDevice(position).device;
if (device == null) return;
final Intent intent = new Intent(this, DeviceControlActivity.class);
if (ActivityCompat.checkSelfPermission(DeviceScanActivity.this, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) {
TODO: Consider calling
ActivityCompat#requestPermissions
here to request the missing permissions, and then overriding
public void onRequestPermissionsResult(int requestCode, String[] permissions,
int[] grantResults)
to handle the case where the user grants the permission. See the documentation
for ActivityCompat#requestPermissions for more details.
return;`
}
————————————-PUBLIC CLASS———————————————————————
public class DeviceScanActivity extends ListActivity {
private LeDeviceListAdapter mLeDeviceListAdapter;
private BluetoothAdapter mBluetoothAdapter;
private boolean mScanning;
private Handler mHandler;private static final int REQUEST_ENABLE_BT = 1;
Stops scanning after 10 seconds.
private static final long SCAN_PERIOD = 10000;private static final int PERMISSION_REQUEST_COARSE_LOCATION = 456;
Some guide line please