Skip to content

Instantly share code, notes, and snippets.

@Gofilord
Last active August 29, 2015 14:14
Show Gist options
  • Save Gofilord/c8768ae523d51b80673e to your computer and use it in GitHub Desktop.
Save Gofilord/c8768ae523d51b80673e to your computer and use it in GitHub Desktop.
public void onCreate(...) {
...
SwipeDismissListViewTouchListener.DismissCallbacks dismissCallbacks = new SwipeDismissListViewTouchListener.DismissCallbacks() {
@Override
public boolean canDismiss(int position) {
return true;
}
@Override
public void onDismiss(ListView listView, int[] reverseSortedPositions) {
for (int position : reverseSortedPositions)
removeHero(position);
// update the list view
list.setAdapter(adapter);
// notify the user by a toast
Toast toast = Toast.makeText(MainActivity.this, "Removed", Toast.LENGTH_SHORT);
toast.show();
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment