Reputation: 1569
I have a listview in which i have 5 integer items.How to change the positions of items in the listview.Suppose i want to swap first and third items in the listview.How can this be achieved ?Somebody please help...
Upvotes: 0
Views: 2911
Reputation: 2404
1.Perform the swap in the List that constitutes your ListView,
int temp = list.get(2);
list.set(2,list.get(0));
list.set(0,temp);
2.Notify your adapter about this change;
adapter.notifyDataSetChanged();
Upvotes: 1