I want to create a TextView
in an Android app which shows how many bluetooth devices are found and list them in the UI.
Inside the MainActivity
(only acivity), there is an ArrayList
inside a private class ListAdapter extends BaseAdapter
. Besides in that class there is also a private BluetoothAdapter.LeScanCallback
with onLeScan
method that includes ListAdapter.notifyDataSetChanged()
. The ListAdapter
uses a listView
to bind the results of bluetooth scanning to the UI. The issue now is that I don't know how to create a trigger that sends the currently found/displayed (and constantly changing) amount of devices in a simple TextView
above (!) the ArrayList
and updates it every time the amount of devices in the list varies.
Do you have any suggestions? I have only found examples from different cases, and mostly with updating through buttons.
You should crate an listener
for when a new Bluetooth scan is done. That listener
should update the UI, TextView
. Read more about Android Callbacks here.