3

I am new to accessibility workarounds in android, please help me fix the issue with losing focus while deleting any item from recycler view. I used the code below for this, but it doesn't seem to be working.

Override method getItemId(), give a stable id to each item:

@Override
public long getItemId(int position) {
    return position;
}

Set has StableId:

adapter.setHasStableIds(true);

Now basically you can keep focus in a concrete item when call notifyDatasetChange, if not, disable animator:

mRecyclerView.setItemAnimator(null);

from here

But it's not working. I just need the way around how we can keep the focus after deleting the item from recycler view. Thanks.

AurumTechie
  • 166
  • 3
  • 14

0 Answers0