Skip to content

Instantly share code, notes, and snippets.

@shubhamnikam
Last active July 6, 2019 18:36
Show Gist options
  • Save shubhamnikam/4703d95e83b4397c12e91689964d7f6d to your computer and use it in GitHub Desktop.
Save shubhamnikam/4703d95e83b4397c12e91689964d7f6d to your computer and use it in GitHub Desktop.
RecyclerView Adapter Swipe Right/Left
public void deleteCurrentTodoItem(final int position) {
mRealm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
//needed appropriate action for db manipulation
//I've used realmDb so, use next line if your using realmDb
//and need to deleteItem from db
//otherwise write your code to implement required functionality
mRealmTodoList.deleteFromRealm(position);
notifyDataSetChanged();
notifyItemRemoved(position);
//notifyItemChanged(position);
notifyItemRangeChanged(position, mRealmTodoList.size());
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment