title: Cannot call this method while RecyclerView is computing a layout or scrolling when try remove item from recyclerview
body: <p>I am Trying to remove my item from recyclerview, but i always getting error </p>
  
  <blockquote>
    <p>java.lang.IllegalStateException: Cannot call this method while
    RecyclerView is computing a layout or scrolling</p>
  </blockquote>
  
  <p>i am using notify datasetchanged, can i solve this?</p>
  
  <pre><code>public class AdapterIntransit extends RecyclerView.Adapter&lt;AdapterIntransit.ViewHolder&gt; {
      private Context context;
      List&lt;DataIntransit&gt; data;
  
      public AdapterIntransit(Context context, List&lt;DataIntransit&gt; data) {
          this.context = context;
          this.data = data;
      }
  
      @Override
      public AdapterIntransit.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardintransit, parent, false);
          return new ViewHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(AdapterIntransit.ViewHolder holder, int position) {
          if (data.get(position).getJml1() - data.get(position).getJml2() &lt;= 0) {
              data.remove(position);
              notifyItemRemoved(position);
              notifyItemRangeChanged(position, getItemCount());
              notifyDataSetChanged();
          } else {
              holder.kode.setText(data.get(position).getKode());
              holder.nama.setText(data.get(position).getNama());
              holder.jumlah.setText(String.valueOf(data.get(position).getJml1() - data.get(position).getJml2()));
          }
      }
  
      @Override
      public int getItemCount() {
          return data.size();
      }
      public class ViewHolder extends RecyclerView.ViewHolder{
          TextView kode, nama, jumlah;
          public ViewHolder(View itemView) {
              super(itemView);
              kode = (TextView)itemView.findViewById(R.id.kode);
              nama = (TextView)itemView.findViewById(R.id.nama);
              jumlah = (TextView)itemView.findViewById(R.id.jumlah);
  
          }
      }
  }
  </code></pre>