Jack
Jack

Reputation: 89

how to stop refreshing list items in list-view while scrolling

I would like stop refreshing the UI in list-view as i am using Custom Adapter. in my list view contains music with progress-bar. when i want to play the progress-bar it starts when scroll down get back to that progress-bar reset to initial, but media player continue playing.

Upvotes: 2

Views: 614

Answers (1)

Prasad
Prasad

Reputation: 119

Try this

//Save where you last were in the list.
int index = mList.getFirstVisiblePosition();
View v = mList.getChildAt(0);
// Call to notify, or updated(change, remove, move, add)

notifyDatasetChanged()
int top = (v == null) ? 0 : v.getTop();

//Prevents the scroll to the new item at the new position
mList.setSelectionFromTop(index, top); 

Upvotes: 2

Related Questions