IndexOutOfBoundsException: Inconsistency detected. Invalid item position- RecylerView

IndexOutOfBoundsException: Inconsistency detected. Invalid item position- RecylerView

I have two recycler view let be RecylerA and RecylerB While the RecyclerB on the last position I load the remaining data and notify the RecyclerB Adapter. Its work fine for me.But while loading RecyclerB, I try to click the RecyclerA, RecylerA actually clears the RecylerB Adapter and load new Data through API.Almost all time its work fine for me. But some time I go through an issue as follow,

 java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 24(offset:24).state:36 android.support.v7.widget.RecyclerView{620771f VFED..... ...
        at android.support.v7.widget.RecyclerView$Recycler.a(Unknown Source:389)
        at android.support.v7.widget.GapWorker.prefetchPositionWithDeadline(Unknown Source:14)
        at android.support.v7.widget.GapWorker.flushTaskWithDeadline(Unknown Source:15)
        at android.support.v7.widget.GapWorker.flushTasksWithDeadline(Unknown Source:22)
        at android.support.v7.widget.GapWorker.a(Unknown Source:3)
        at android.support.v7.widget.GapWorker.run(Unknown Source:71)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6626)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)

I try the almost all solution I see on StackOverflow like

mRecyclerViewproduct.getRecycledViewPool().clear();
mRecyclerViewproduct.setItemAnimator(null);

before notifying adapter. Also, an additional time delay for notifying adapter. Update the notifying adapter using position etc. But no solution works for me. Is there any new idea or solution for this ??

Update: Adapter for RecyclerA as follow (viewHolder)

if (selectedPosition == position) {
            holder.list_rv_productchip.setTextColor(Color.WHITE);
            holder.itemView.setBackground(context.getResources().getDrawable(R.drawable.chipselected));
        } else {
            holder.list_rv_productchip.setTextColor(Color.BLACK);
            holder.itemView.setBackground(context.getResources().getDrawable(R.drawable.quantityblack));
        }

        holder.itemView.setOnClickListener(view -> {
            selectedPosition = position;
            notifyDataSetChanged();
            ((CategorywiseProductlistActivity) context).loadingpageflag = true;
            ((CategorywiseProductlistActivity) context).filterdata = "{\"filter\":{ } }";
            constantsVariables.category_wise_product_paging=1;
            ((CategorywiseProductlistActivity) context).makeCategorycurrentidtochip(subCategories.get(position).getId());
            if (subCategories.get(position).getName().matches("All Items")) {
                ((CategorywiseProductlistActivity) context).titleallproducts.setText("All in " + ((CategorywiseProductlistActivity) context).headtitle);
            } else {
                ((CategorywiseProductlistActivity) context).titleallproducts.setText("All in " + subCategories.get(position).getName());
            }
            ((CategorywiseProductlistActivity) context).Categorycurrentid = "" + subCategories.get(position).getId();
            ((CategorywiseProductlistActivity) context).displayproducts(subCategories.get(position).getId(), "{\"filter\":{ } }");
        });