我正在制作包含Firebase Pet的Cardview Feed 具有这样的布局
另一个表是用户
我想填充cardview并将UID从Pets转换为用户名。
在这里输入我的代码
答案 0 :(得分:0)
@Override
public void onStart() {
super.onStart();
FirebaseRecyclerAdapter<Model, ViewHolder> firebaseRecyclerAdapter =
new FirebaseRecyclerAdapter<Model, ViewHolder>(Model.class,R.layout.row,ViewHolder.class,mref)
{
@Override
protected void populateViewHolder(ViewHolder viewHolder, Model model, int position) {
String userid = model.getUserid().toString();
viewHolder.setDetails(getActivity().getApplicationContext(),model.getPetname(),"Reason:" + model.getReason(),model.getPetpicture(),"Breed:" + model.getBreed(),
"Age: " + model.getAge(),"Size: " + model.getPetsize() +"yrs old","Color:" + model.getPetcolor(),"",model.datepost);
}
};
recyclerView.setAdapter(firebaseRecyclerAdapter);
}