Open meablelee2013 opened 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 .
Did you happen to get solution ???
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 .