如果满足条件,如何从回收者视图中删除?

时间:2019-03-13 12:14:50

标签: android firebase firebase-realtime-database android-recyclerview

因此,我要从Firebase检索数据,如果要满足条件,我想删除一个项目,但不是从数据库recyclerview中删除该项目

这是我的代码:

for (DataSnapshot roomSnapshot : dataSnapshot.getChildren()) {
     minmax.clear();
     DataSnapshot priceSnapshot = roomSnapshot.child("promos").child("regular").child(ym).child("price").child(guest);
     for (DataSnapshot ds : priceSnapshot.getChildren()) {
          minmax.addAll(Collections.singleton(Integer.parseInt("" + ds.getValue())));
          minmax.removeAll(Collections.singletonList(0));
          if(minmax.isEmpty()){
             mAdapter.notifyItemRemoved(holder.getAdapterPosition()); 
          }else{
           int min = Collections.min(minmax);
           holder.hPrice.setText("Start From " + String.valueOf(min));
          }
      mAdapter.notifyDataSetChanged();
    }
}

0 个答案:

没有答案