I have an android app with a screen that comprises of a ListView, which I am using to display a list of devices. These devices are held in an array.
I am trying to use
For an ArrayAdapter, notifyDataSetChanged
only works if you use the add
, insert
, remove
, and clear
functions on the Adapter.
arrayAdapter.clear()
arrayAdapter.addAll(deviceList)
Alternatives:
Repeat this step after new devicelist is formed - but this is redundant
arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, deviceList);