1
当用户通过选择下拉菜单过滤数据时如何更新我的Firebase列表适配器。菜单包含字符串值,我的代码如下:当用户通过选择下拉菜单过滤数据时更新Firebase列表适配器
FirebaseListAdapter<blood> adapter=new FirebaseListAdapter<blood>(this, blood.class, R.layout.blod,mref) {
@Override
protected void populateView(View v, blood model, int position)
{
final String pskey=getRef(position).getKey();
TextView name_,groiup;
ImageView Pic;
groiup=(TextView)v.findViewById(R.id.bldgrp);
name_=(TextView)v.findViewById(R.id.name1);
Pic=(ImageView)v.findViewById(R.id.pic);
name_.setText(model.getName());
groiup.setText(model.getBlodgrp());
}
在创建FirebaseListAdapter后,您无法更改其查询。您必须创建一个新的适配器并将其与视图绑定。请参阅https://stackoverflow.com/questions/40919636/how-to-update-a-firebaserecycleradapters-query/40923600#40923600 –
@FrankvanPuffelen如何绑定新的适配器,因为我使用的是Firebase列表适配器.firebase团队应该将脱机过滤器或搜索机制firebase名单adapter.or否则没有办法使用它.. – Pritz10