I have listView with drag drop functionality. I'm using ListView with custom layout- I have SeekBar and TextView in custom ListView layout. When I drag and drop each ListView items after changing SeekBar value, TextView is moving and SeekBar value is not moving.
It may be caused by Adapter. So I've share my adapter codes.
https://gist.github.com/salihyalcin/38e320726e3ab8346c50
Thanks in advance
EDIT --- My ListItem Class
class ListItem {
String textdata;
public ListItem(String textdata) {
this.textdata = textdata;
}
public boolean equals(Object o) {
ListItem ndListItemObject = (ListItem) o;
return this.textdata.equalsIgnoreCase(ndListItemObject.textdata);
}
}
** My ListView looks like image below
** Change the SeekBar value of Layer1
** Drag-Drop Layer1 and Layer2
** Layer1 and Layer2 moved but SeekBar values stay same place, they didn't moved.
I think I have an idea. First, your post is missing code snippet of the definition of
NavigationDrawerFragment.ListItem
class, could be helpful. I do remember that you call methodswapElements
in DynamicListView but other readers probably don't need to know it.My suggestion is to save the progress value into the
ListItem
class, sample code below. We will depend onswapElements
() to swap the 2 ListItem objects properly, along with the progress and text (layers in your case).EDIT, code suggestion for ListItem class:
Notes for ListItem code:
seekBarValue
as a public data member, and anotherListItem
constructor for the caller's convenience.Code snippet suggestion for the Adapter:
Notes:
...item = myItems.get(position);
to get the correct item in the ArrayList.item.seekBarValue
You may remove these codes below unless you plan on using it, of course: