@Override
protected void onStart() {
super.onStart();
FirebaseRecyclerAdapter <ZedMate,ZedmateViewHolder> FBRA = new FirebaseRecyclerAdapter<ZedMate, ZedmateViewHolder>(
ZedMate.class,
R.layout.zedmate,
ZedmateViewHolder.class,
databaseReference
) {
@Override
protected void populateViewHolder(ZedmateViewHolder viewHolder, ZedMate model, int position) {
viewHolder.setTitle(model.getTitle());
viewHolder.setDesc(model.getDesc());
}
};
recyclerView.setAdapter(FBRA);
}
public static class ZedmateViewHolder extends RecyclerView.ViewHolder{
public ZedmateViewHolder(View itemView){
super(itemView);
View mView = itemView;
}
public void setTitle(String title){
TextView ptitle = (TextView)itemView.findViewById(R.id.mytitle);
ptitle.setText(title);
}
public void setDesc(String desc){
TextView pdesc = (TextView)itemView.findViewById(R.id.mydescription);
pdesc.setText(desc);
}
}