I have a ListView with a row of items, where each row contains a SeekBar and TextView. Whenever I move any of the SeekBar‘s I need to have all the TextView‘s in the ListView updated live, without losing focus on the SeekBar.
I have tried to
-
call
notifyDataSetChanged()on theListView, but the
SeekBarloses focus. -
loop through the
ListViewwith the following code:
for (int i = 0; i < listView.getChildCount(); i++)
{
TextView tv = (TextView) listView.getChildAt(i).findViewById(R.id.textView1);
String value = getData();
tv.setText(value);
}
However, the code above doesn’t give a persistent update to the ListView, which is a problem if the user scrolls.
Any suggestions how to deal with this problem?
What you want to do is updating the data list of the adapter without calling
notifyDataSetChanged()and then also update theTextViewsfrom the currently visible rows.This should offer you a smooth update.