我正在使用滑动到解除库,但是在刷掉列表项之后应用程序崩溃了。 我使用以下代码:
todolist = (ListView)findViewById(R.id.todo_items);
SwipeDismissListViewTouchListener touchListener =
new SwipeDismissListViewTouchListener(
todolist,
new SwipeDismissListViewTouchListener.DismissCallbacks() {
@Override
public boolean canDismiss(int position) {
return true;
}
@Override
public void onDismiss(ListView listView, int[] reverseSortedPositions) {
for (int position : reverseSortedPositions) {
mAdapter.remove(mAdapter.getItem(position));
}
mAdapter.notifyDataSetChanged();
}
});
todolist.setOnTouchListener(touchListener);
todolist.setOnScrollListener(touchListener.makeScrollListener());
该应用在此行中提供了UnsupportedoperationException:
com.example.todolist.ToDoListActivity$1.onDismiss(ToDoListActivity.java:81)
我该如何解决这个问题? 我指的是这个代码示例:
谢谢!