Figen Güngör
Figen Güngör

Reputation: 12559

Removing item from Realm and RecyclerView

Here is how I try to remove item from realm and recylerview:

public void deleteHistoryTerm(int position){
        mRealm.beginTransaction();
        mResults.get(position).deleteFromRealm();
        mRealm.commitTransaction();
        mAdapter.notifyItemRemoved(position);
    }

However, instead of removed item, recylerView displays an empty holder for that item and it goes away when you tap on it. What might be the cause?

Upvotes: 0

Views: 150

Answers (1)

Figen Güngör
Figen Güngör

Reputation: 12559

I got it. I should be removing specific items as following:

    mResults.deleteFromRealm(position);

Upvotes: 1

Related Questions