@SuppressLint("NewApi") private void getScanResualt() { mLeScanCallback = new LeScanCallback() { @Override public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanRecord) { MainActivity.this.runOnUiThread(new Runnable() { public void run() { mBleDeviceListAdapter.addDevice(device, rssi, Utils.bytesToHex(scanRecord)); mBleDeviceListAdapter.notifyDataSetChanged(); invalidateOptionsMenu(); } }); } }; }