我想从我的项目中删除一个项目RecyclerView,但我总是收到错误.
java.lang.IllegalStateException:当RecyclerView正在计算布局或滚动时,无法调用此方法
我在用notifyDataSetChanged().我怎么解决这个问题?
这是我的适配器代码
public class ListAdapters extends RecyclerView.Adapter<ListAdapters.MyViewHolder> {
public ArrayList<String> tvdatalist;
Context c;
int pos;
ListAdapters.MyViewHolder myViewHolder;
private LayoutInflater layoutInflater;
int[] arr;
public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
public EditText edttxt;
public CheckBox cb;
public MyViewHolder(View view) {
super(view);
edttxt = (EditText) view.findViewById(R.id.edttxt);
cb = (CheckBox) view.findViewById(R.id.cb);
}
@Override
public void onClick(View v) {
}
}
public ListAdapters(Context c, ArrayList<String> tvdatalist) {
this.c = c;
this.layoutInflater = LayoutInflater.from(c);
this.tvdatalist = tvdatalist;
arr …Run Code Online (Sandbox Code Playgroud)