-3

There is an app in which BLE devices are scanned and the device's MAC and RSSI value is displayed along with a button to connect with that device.

RSSI value is coming from scan results of BLE scan and are updated on ListView. the frequency at which devices are scanned is too high and hence the RSSI value is changing frequently. With every scan a callback is called which updates the value of RSSI in listrong textst and calls notifyDataSetChanged().

Means with every scan results notifyDataSetChanged() is called to refresh RSSI values on UI. But calling notifyDataSetChanged() too frequently is avoiding me to click on button. I click on button but it is no actually click (my click is lost somewhere) while callback is refreshing adapter again and again.

Here is the similar kind of situation i guess but solution is not known

Click HERE

Community
  • 1
  • 1
Sachin Verma
  • 69
  • 1
  • 4

1 Answers1

0

If you only add/modify/remove an item on a listview you can try using one of these more specific functions:

notifyItemChanged(int)
notifyItemInserted(int)
notifyItemRemoved(int)
notifyItemRangeChanged(int, int)
notifyItemRangeInserted(int, int)
notifyItemRangeRemoved(int, int)

For more info check this: https://stackoverflow.com/a/33792079/6632568

Community
  • 1
  • 1
beeb
  • 1,615
  • 1
  • 12
  • 24