简体   繁体   English

Android RecyclerView:notifyDataSetChanged() IllegalStateException

[英]Android RecyclerView : notifyDataSetChanged() IllegalStateException

I'm trying to update the items of a recycleview using notifyDataSetChanged().我正在尝试使用 notifyDataSetChanged() 更新回收视图的项目。

This is my onBindViewHolder() method in the recycleview adapter.这是我在 recycleview 适配器中的 onBindViewHolder() 方法。

@Override
public void onBindViewHolder(ViewHolder viewHolder, int position) {

     //checkbox view listener
    viewHolder.getCheckbox().setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

            //update list items
            notifyDataSetChanged();
        }
    });
}

What I want to do is update the list items, after I check a checkbox.我想要做的是在选中复选框后更新列表项。 I get an illegal exception though: "Cannot call this method while RecyclerView is computing a layout or scrolling"我得到一个非法异常: "Cannot call this method while RecyclerView is computing a layout or scrolling"

java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
    at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:1462)
    at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onChanged(RecyclerView.java:2982)
    at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:7493)
    at android.support.v7.widget.RecyclerView$Adapter.notifyDataSetChanged(RecyclerView.java:4338)
    at com.app.myapp.screens.RecycleAdapter.onRowSelect(RecycleAdapter.java:111)

I also used notifyItemChanged(), same exception.我也使用了notifyItemChanged(),同样的异常。 Any secret way to update to notify the adapter that something changed?任何更新以通知适配器发生变化的秘密方法?

You should move method 'setOnCheckedChangeListener()' to ViewHolder which is inner class on your adapter.您应该将方法 'setOnCheckedChangeListener()' 移动到 ViewHolder,它是您的适配器上的内部类。

onBindViewHolder() is not a method that initialize ViewHolder . onBindViewHolder()不是初始化ViewHolder的方法。 This method is step of refresh each recycler item.此方法是刷新每个回收站项目的步骤。 When you call notifyDataSetChanged() , onBindViewHolder() will be called as the number of each item times.当您调用notifyDataSetChanged()onBindViewHolder()将作为每个项目的次数被调用。

So If you notifyDataSetChanged() put into onCheckChanged() and initialize checkBox in onBindViewHolder() , you will get IllegalStateException because of circular method call.因此,如果您将notifyDataSetChanged()放入onCheckChanged()并在onBindViewHolder()初始化 checkBox , onBindViewHolder()由于循环方法调用而得到 IllegalStateException 。

click checkbox -> onCheckedChanged() -> notifyDataSetChanged() -> onBindViewHolder() -> set checkbox -> onChecked...单击复选框 -> onCheckedChanged() -> notifyDataSetChanged() -> onBindViewHolder() -> 设置复选框 -> onChecked...

Simply, you can fix this by put one flag into Adapter.简单地说,您可以通过将一个标志放入 Adapter 来解决此问题。

try this,尝试这个,

private boolean onBind;

public ViewHolder(View itemView) {
    super(itemView);
    mCheckBox = (CheckBox) itemView.findViewById(R.id.checkboxId);
    mCheckBox.setOnCheckChangeListener(this);
}

@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if(!onBind) {
        // your process when checkBox changed
        // ...

        notifyDataSetChanged();
    }
}

...

@Override
public void onBindViewHolder(YourAdapter.ViewHolder viewHolder, int position) {
    // process other views 
    // ...

    onBind = true;
    viewHolder.mCheckBox.setChecked(trueOrFalse);
    onBind = false;
}

You can just reset the previous listener before you make changes and you won't get this exception.您可以在进行更改之前重置先前的侦听器,并且不会收到此异常。

private CompoundButton.OnCheckedChangeListener checkedListener = new CompoundButton.OnCheckedChangeListener() {                      
                        @Override
                        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                            //Do your stuff
                    });;

    @Override
    public void onBindViewHolder(final ViewHolder holder, final int position) {
        holder.checkbox.setOnCheckedChangeListener(null);
        holder.checkbox.setChecked(condition);
        holder.checkbox.setOnCheckedChangeListener(checkedListener);
    }

使用Handler添加项目并从该Handler调用notify...()为我解决了这个问题。

I don't know well, but I also had same problem.我不太清楚,但我也遇到了同样的问题。 I solved this by using onClickListner on checkbox我通过在checkbox上使用onClickListner解决了这个问题

viewHolder.mCheckBox.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            if (model.isCheckboxBoolean()) {
                model.setCheckboxBoolean(false);
                viewHolder.mCheckBox.setChecked(false);
            } else {
                model.setCheckboxBoolean(true);
                viewHolder.mCheckBox.setChecked(true);
            }
            notifyDataSetChanged();
        }
    });

Try this, this may help!试试这个,这可能会有所帮助!

protected void postAndNotifyAdapter(final Handler handler, final RecyclerView recyclerView, final RecyclerView.Adapter adapter) {
        handler.post(new Runnable() {
            @Override
            public void run() {
                if (!recyclerView.isComputingLayout()) {
                    adapter.notifyDataSetChanged();
                } else {
                    postAndNotifyAdapter(handler, recyclerView, adapter);
                }
            }
        });
    }

Found a simple solution -找到了一个简单的解决方案 -

public class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{

    private RecyclerView mRecyclerView; 

    @Override
    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
        mRecyclerView = recyclerView;
    }

    private CompoundButton.OnCheckedChangeListener checkedChangeListener 
    = (compoundButton, b) -> {
        final int position = (int) compoundButton.getTag();
        // This class is used to make changes to child view
        final Event event = mDataset.get(position);
        // Update state of checkbox or some other computation which you require
        event.state = b;
        // we create a runnable and then notify item changed at position, this fix crash
        mRecyclerView.post(new Runnable() {
            @Override public void run() {
                notifyItemChanged(position));
            }
        });
    }
}

Here we create a runnable to notifyItemChanged for a position when recyclerview is ready to handle it.当 recyclerview 准备好处理它时,我们为一个位置创建了一个可运行的 notifyItemChanged 。

When you have the Message Error:当您收到消息错误时:

Cannot call this method while RecyclerView is computing a layout or scrolling

Simple, Just do what cause the Exception in:很简单,只要做导致异常的原因:

RecyclerView.post(new Runnable() {
    @Override
    public void run() {
        /** 
        ** Put Your Code here, exemple:
        **/
        notifyItemChanged(position);
    }
});

At first I thought Moonsoo's answer (the accepted answer) wouldn't work for me because I cannot initialize my setOnCheckedChangeListener() in the ViewHolder constructor because I need to bind it each time so it gets an updated position variable.起初我认为Moonsoo 的答案(已接受的答案)对我不起作用,因为我无法在 ViewHolder 构造函数中初始化我的setOnCheckedChangeListener() ,因为我每次都需要绑定它以便获得更新的位置变量。 But it took me a long time to realize what he was saying.但我花了很长时间才明白他在说什么。

Here is an example of the "circular method call" he is talking about:这是他正在谈论的“循环方法调用”的一个例子:

public void onBindViewHolder(final ViewHolder holder, final int position) {
    SwitchCompat mySwitch = (SwitchCompat) view.findViewById(R.id.switch);
    mySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                       if (isChecked) {
                           data.delete(position);
                           notifyItemRemoved(position);
                           //This will call onBindViewHolder, but we can't do that when we are already in onBindViewHolder!
                           notifyItemRangeChanged(position, data.size());
                       }
                   }
            });
    //Set the switch to how it previously was.
    mySwitch.setChecked(savedSwitchState); //If the saved state was "true", then this will trigger the infinite loop.
}

The only problem with this, is that when we need to initialize the switch to be on or off (from past saved state, for example), it is calling the listener which might call nofityItemRangeChanged which calls onBindViewHolder again.与此唯一的问题是,当我们需要初始化开关打开或关闭(从过去的保存状态,例如),它在调用可能调用监听nofityItemRangeChanged这就要求onBindViewHolder一次。 You cannot call onBindViewHolder when you are already in onBindViewHolder ], because you cannot notifyItemRangeChanged if you are already in the middle of notifying that the item range has changed.你不能叫onBindViewHolder当你已经在onBindViewHolder ],因为你不能notifyItemRangeChanged如果你已经在通知该项目范围已经改变的中间。 But I only needed to update the UI to show it on or off, not wanting to actually trigger anything.但我只需要更新 UI 以显示它的开启或关闭,并不想真正触发任何东西。

Here is the solution I learned from JoniDS's answer that will prevent the infinite loop.这是我从JoniDS 的回答中学到的解决方案,可以防止无限循环。 As long as we set the listener to "null" before we set Checked, then it will update the UI without triggering the listener, avoiding the infinite loop.只要我们在设置Checked之前将监听器设置为“null”,那么它就会在不触发监听器的情况下更新UI,避免死循环。 Then we can set the listener after.然后我们可以设置监听器。

JoniDS's code: JoniDS的代码:

holder.checkbox.setOnCheckedChangeListener(null);
holder.checkbox.setChecked(condition);
holder.checkbox.setOnCheckedChangeListener(checkedListener);

Full solution to my example:我的例子的完整解决方案:

public void onBindViewHolder(final ViewHolder holder, final int position) {
    SwitchCompat mySwitch = (SwitchCompat) view.findViewById(R.id.switch);

    //Set it to null to erase an existing listener from a recycled view.
    mySwitch.setOnCheckedChangeListener(null);

    //Set the switch to how it previously was without triggering the listener.
    mySwitch.setChecked(savedSwitchState); //If the saved state was "true", then this will trigger the infinite loop.

    //Set the listener now.
    mySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                data.delete(position);
                notifyItemRemoved(position);
                //This will call onBindViewHolder, but we can't do that when we are already in onBindViewHolder!
                notifyItemRangeChanged(position, data.size());
            }
        }
    });
}

your CheckBox item is in changing drawable when you call notifyDataSetChanged();当您调用notifyDataSetChanged();时,您的 CheckBox 项目正在更改 drawable notifyDataSetChanged(); so this exception would be occurred.所以会发生这个异常。 Try call notifyDataSetChanged();尝试调用notifyDataSetChanged(); in post of your view.在您看来。 For Example:例如:

buttonView.post(new Runnable() {
                    @Override
                    public void run() {
                        notifyDataSetChanged();
                    }
                });

Why not checking the RecyclerView.isComputingLayout() state as follows?为什么不检查RecyclerView.isComputingLayout()状态如下?

public class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{

    private RecyclerView mRecyclerView; 

    @Override
    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
        mRecyclerView = recyclerView;
    }

    @Override
    public void onBindViewHolder(ViewHolder viewHolder, int position) {

        viewHolder.getCheckbox().setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (mRecyclerView != null && !mRecyclerView.isComputingLayout()) {
                    notifyDataSetChanged();
                }
            }
        });
    }
}

While item is being bound by the layout manager, it is very likely that you are setting the checked state of your checkbox, which is triggering the callback.当项目被布局管理器绑定时,很可能您正在设置复选框的选中状态,这会触发回调。

Of course this is a guess because you did not publish the full stack trace.当然,这是一个猜测,因为您没有发布完整的堆栈跟踪。

You cannot change adapter contents while RV is recalculating the layout.当 RV 重新计算布局时,您无法更改适配器内容。 You can avoid it by not calling notifyDataSetChanged if item's checked state is equal to the value sent in the callback (which will be the case if calling checkbox.setChecked is triggering the callback).如果 item 的选中状态等于回调中发送的值,您可以通过不调用 notifyDataSetChanged 来避免它(如果调用checkbox.setChecked触发回调,则会出现这种情况)。

Use onClickListner on checkbox instead of OnCheckedChangeListener, It will solve the problem在复选框上使用 onClickListner 而不是 OnCheckedChangeListener,它将解决问题

viewHolder.myCheckBox.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (viewHolder.myCheckBox.isChecked()) {
                // Do something when checkbox is checked
            } else {
                // Do something when checkbox is unchecked                
            }
            notifyDataSetChanged();
        }
    });

notifyDataSetChanged()之前,只需使用此方法检查: recyclerView.IsComputingLayout()

Simple use Post:简单使用后:

new Handler().post(new Runnable() {
        @Override
        public void run() {
                mAdapter.notifyItemChanged(mAdapter.getItemCount() - 1);
            }
        }
    });

I suffered with this problem for hour and this is how you can fix it.我遇到了这个问题一个小时,这就是你可以解决它的方法。 But before you began there are some conditions to this solution.但是在您开始之前,此解决方案有一些条件。

MODEL CLASS模型类

public class SelectUserModel {

    private String userName;
    private String UserId;
    private Boolean isSelected;


    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserId() {
        return UserId;
    }

    public void setUserId(String userId) {
        UserId = userId;
    }

    public Boolean getSelected() {
        return isSelected;
    }

    public void setSelected(Boolean selected) {
        isSelected = selected;
    }
}

CHECKBOX in ADAPTER CLASS适配器类中的复选框

CheckBox cb;

ADAPTER CLASS CONSTRUCTOR & LIST OF MODEL适配器类构造器和模型列表

private List<SelectUserModel> userList;

public StudentListAdapter(List<SelectUserModel> userList) {
        this.userList = userList;

        for (int i = 0; i < this.userList.size(); i++) {
            this.userList.get(i).setSelected(false);
        }
    }

ONBINDVIEW [Please use onclick in place of onCheckChange] ONBINDVIEW [请使用 onclick 代替 onCheckChange]

public void onBindViewHolder(@NonNull final StudentListAdapter.ViewHolder holder, int position) {
    holder.cb.setChecked(user.getSelected());
    holder.cb.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            int pos = (int) view.getTag();
            Log.d(TAG, "onClick: " + pos);
            for (int i = 0; i < userList.size(); i++) {
                if (i == pos) {
                    userList.get(i).setSelected(true);
// an interface to listen to callbacks
                    clickListener.onStudentItemClicked(userList.get(i));
                } else {
                    userList.get(i).setSelected(false);
                }
            }
            notifyDataSetChanged();
        }
    });

} }

I ran into this exact issue!我遇到了这个确切的问题! After Moonsoo's answer didn't really float my boat, I messed around a bit and found a solution that worked for me.在 Moonsoo 的回答并没有真正让我的船漂浮之后,我搞砸了一点,找到了一个对我有用的解决方案。

First, here's some of my code:首先,这是我的一些代码:

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {

    final Event event = mDataset.get(position);

    //
    //  .......
    //

    holder.mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            event.setActive(isChecked);
            try {
                notifyItemChanged(position);
            } catch (Exception e) {
                Log.e("onCheckChanged", e.getMessage());
            }
        }
    });

You'll notice I'm specifically notifying the adapter for the position I'm changing, instead of the entire dataset like you're doing.您会注意到我专门通知适配器我正在更改的位置,而不是像您正在做的整个数据集。 That being said, although I can't guarantee this will work for you, I resolved the problem by wrapping my notifyItemChanged() call in a try/catch block.话虽如此,虽然我不能保证这对你notifyItemChanged() ,但我通过将我的notifyItemChanged()调用包装在 try/catch 块中解决了这个问题。 This simply caught the exception, but still allowed my adapter to register the state change and update the display!这只是捕获了异常,但仍然允许我的适配器注册状态更改并更新显示!

Hope this helps someone!希望这可以帮助某人!

EDIT: I'll admit, this probably is not the proper/mature way of handle the issue, but since it doesn't appear to be causing any problems by leaving the exception unhandled, I thought I'd share in case it was good enough for someone else.编辑:我承认,这可能不是处理这个问题的正确/成熟的方法,但由于它似乎不会因为未处理异常而导致任何问题,我想我会分享以防万一对别人来说足够了。

This is happening because you're probably setting the 'listener' before you configure the value for that row, which makes the listener to get triggered when you 'configure the value' for the checkbox.发生这种情况是因为您可能在配置该行的值之前设置了“侦听器”,这会使侦听器在您为复选框“配置值”时被触发。

What you need to do is:你需要做的是:

@Override
public void onBindViewHolder(YourAdapter.ViewHolder viewHolder, int position) {
   viewHolder.mCheckBox.setOnCheckedChangeListener(null);
   viewHolder.mCheckBox.setChecked(trueOrFalse);
   viewHolder.setOnCheckedChangeListener(yourCheckedChangeListener);
}
        @Override
        public void onBindViewHolder(final MyViewHolder holder, final int position) {
            holder.textStudentName.setText(getStudentList.get(position).getName());
            holder.rbSelect.setChecked(getStudentList.get(position).isSelected());
            holder.rbSelect.setTag(position); // This line is important.
            holder.rbSelect.setOnClickListener(onStateChangedListener(holder.rbSelect, position));

        }

        @Override
        public int getItemCount() {
            return getStudentList.size();
        }
        private View.OnClickListener onStateChangedListener(final RadioButton checkBox, final int position) {
            return new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (checkBox.isChecked()) {
                        for (int i = 0; i < getStudentList.size(); i++) {

                            getStudentList.get(i).setSelected(false);

                        }
                        getStudentList.get(position).setSelected(checkBox.isChecked());

                        notifyDataSetChanged();
                    } else {

                    }

                }
            };
        }

simply use isPressed() method of CompoundButton in onCheckedChanged(CompoundButton compoundButton, boolean isChecked)简单地使用isPressed()的方法CompoundButtononCheckedChanged(CompoundButton compoundButton, boolean isChecked)
eg例如

public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {   
                      ... //your functionality    
                            if(compoundButton.isPressed()){
                                notifyDataSetChanged();
                            }
                        }  });

I had the same problem using the Checkbox and the RadioButton.我在使用 Checkbox 和 RadioButton 时遇到了同样的问题。 Replacing notifyDataSetChanged() with notifyItemChanged(position) worked.notifyItemChanged(position)替换notifyDataSetChanged() notifyItemChanged(position)有效。 I added a Boolean field isChecked to the data model.我在数据模型中添加了一个布尔字段isChecked Then I updated the Boolean value and in onCheckedChangedListener , I called notifyItemChanged(adapterPosition) .然后我更新了布尔值,在onCheckedChangedListener ,我调用了notifyItemChanged(adapterPosition) This might not be the best way, but worked for me.这可能不是最好的方法,但对我有用。 The boolean value is used for checking whether the item is checked.布尔值用于检查项目是否被选中。

mostly it happen beacause notifydatasetchanged calling onCheckedchanged event of checkbox and in that event again there is notifydatasetchanged .大多数情况下,这是因为notifydatasetchanged调用了复选框的onCheckedchanged事件,并且在该事件中再次notifydatasetchanged

to solve it you can just check that checkbox is checked by programatically or user pressed it.要解决它,您只需检查复选框是否通过编程或用户按下它被选中。 there is method isPressed for it.有方法isPressed

so wrap whole listner code inside isPressed method.所以将整个侦听器代码包装在 isPressed 方法中。 and its done.它完成了。

 holder.mBinding.cbAnnual.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {

                if(compoundButton.isPressed()) {


                       //your code
                        notifyDataSetChanged();   

            }
        });
 override fun bindItemViewHolder(viewHolder: RecyclerView.ViewHolder, position: Int) {
    var item: ThingChannels = items[position]
    rowActionBinding.xCbChannel.text = item.channelType?.primaryType
    rowActionBinding.xTvRoomName.text = item.thingDetail?.room?.name
    rowActionBinding.xCbChannel.isChecked = item.isSelected
    rowActionBinding.xCbChannel.tag = position
    rowActionBinding.xCbChannel.setOnClickListener {
        setSelected(it.tag as Int)
        if (onItemClickListener != null) {
            onItemClickListener!!.onItemClick(position, null)
        }
    }
}

None of the answers solve the problem!没有一个答案能解决问题!

All of them either suggest using recylerView.post() which gives me the same crash or swallow the change (ie not notify the adapter of the change) if the user is scrolling.如果用户正在滚动,他们要么建议使用recylerView.post() ,这会给我同样的崩溃或吞下更改(即不通知适配器更改)。 This just means that if the user was scrolling when the change was ready, they will never see the change.这只是意味着如果用户在更改准备好时滚动,他们将永远不会看到更改。

The answer答案

Listen for when the user stops scrolling using RecyclerView.OnScrollListener and then notify the adapter:使用RecyclerView.OnScrollListener监听用户何时停止滚动,然后通知适配器:

recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
    override fun onScrollStateChanged(
        recyclerView: RecyclerView,
        newState: Int
    ) {
        if(newState == RecyclerView.SCROLL_STATE_IDLE) recyclerViewAdapter.notifyDataSetChanged()
    }
})

For me problem occurred when I exited from EditText by Done, Back, or outside input touch.对我而言,当我通过 Done、Back 或外部输入触摸退出 EditText 时出现问题。 This causes to update model with input text, then refresh recycler view via live data observing.这会导致使用输入文本更新模型,然后通过实时数据观察刷新回收者视图。

The Problem was that cursor/focus remain in EditText.问题是光标/焦点保留在 EditText 中。

When I have deleted focus by using:当我使用以下方法删除焦点时:

editText.clearFocus() 

Notify data changed method of recycler view did stop throwing this error.回收者视图的通知数据更改方法确实停止抛出此错误。

I think this is one of the possible reason/solutions to this problem.我认为这是该问题的可能原因/解决方案之一。 It is possible that this exception can be fixed in another way as it can be caused by totally different reason.这个异常有可能以另一种方式修复,因为它可能是由完全不同的原因引起的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RecyclerView notifyDataSetChanged IllegalStateException - RecyclerView notifyDataSetChanged IllegalStateException Android viewpager notifyDataSetChanged导致IllegalStateException - Android viewpager notifyDataSetChanged causes IllegalStateException Android for notifyDataSetChanged()获得IllegalStateException错误 - Android for notifyDataSetChanged() get IllegalStateException error 在 Android 中使用带 RecyclerView 的 notifyItemRemoved 或 notifyDataSetChanged - using notifyItemRemoved or notifyDataSetChanged with RecyclerView in Android Android RecyclerView适配器notifyDataSetChanged无法正常工作 - Android RecyclerView Adapter notifyDataSetChanged not working Java android RecyclerView 选择:IllegalStateException - Java android RecyclerView selection: IllegalStateException Android recyclerview:更有效的notifydatasetchanged或notifydatarangeremoved然后notifydatarangeinserted吗? - Android recyclerview: more efficient notifydatasetchanged or notifydatarangeremoved then notifydatarangeinserted? Android RecyclerView MVVM 在哪里使用 notifyDataSetChanged 更新适配器 - Android RecyclerView MVVM where to update Adapter with notifyDataSetChanged Android RecyclerView 在 notifyDataSetChanged 调用上冻结 UI - Android RecyclerView freezes UI on a notifyDataSetChanged call Android RecyclerView 未在 adapter.notifyDataSetChanged 上刷新 - Android RecyclerView not refreshing on adapter.notifyDataSetChanged
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM