@Override
public void onStart() {
super.onStart();
FirebaseRecyclerAdapter<AllUsers, UsersViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<AllUsers, UsersViewHolder>() {
@NonNull
@Override
public UsersViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
}
@Override
protected void onBindViewHolder(@NonNull UsersViewHolder holder, int position, @NonNull AllUsers model) {
holder.setName(model.getName());
holder.setStatus(model.getStatus());
}
};
mUsersList.setAdapter(firebaseRecyclerAdapter);
}
public static class UsersViewHolder extends RecyclerView.ViewHolder{
View mView;
public UsersViewHolder(View itemView) {
super(itemView);
mView = itemView;
}
public void setName(String name) {
TextView mDisplayName = (TextView) mView.findViewById(R.id.display_name);
mDisplayName.setText(name);
}
public void setStatus(String status) {
TextView mDisplayStatus = (TextView) mView.findViewById(R.id.display_status);
mDisplayStatus.setText(status);
}
}
The error is in the following line in which theres a red line showing under ()
:
FirebaseRecyclerAdapter<AllUsers, UsersViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<AllUsers, UsersViewHolder>() {
What should be the parameters that come inside that?
You need to do the following:
First, you need to configure the adapter by building
FirebaseRecyclerOptions
AllUsers
is your POJO class, and you need to make a query to have in the recycler adapter.more info here:
https://github.com/firebase/FirebaseUI-Android/tree/master/database