bauerca / drag-sort-listview

Android ListView with drag and drop reordering.
3.2k stars 1.44k forks source link

IndexOutOfBoundsException: Invalid index 3, size is 0 #115

Open meablelee2013 opened 10 years ago

meablelee2013 commented 10 years ago

When i drag the drag-sort-listview ,it will IndexOutOfBoundsException at adapter.insert(item,to),the detail is below: 1:DragSortListView mListView=(DragSortListView)findViewById(R.id.dragsortlistview); 2:mListView.setDropListener(onDrop); 3:private DragSortListView.DropListener onDrop = new DragSortListView.DropListener() { @Override public void drop(int from, int to) { PunishItem item = mAdapter.getItem(from); mAdapter.remove(item); mAdapter.insert(item, to); System.out.println("from = " + from); System.out.println("to = " + to); } }; 4:mAdapter = new MyAdapter(this, 0, mList);(MyAdapter extends ArrayAdapter) mListView.setAdater(mAdapter)

and then when i drag down or up the item ,it will occur IndexOutOfBoundsException, anyone can fix it ,thanks .

bharath-kg commented 9 years ago

Did you happen to get solution ???