Java – Why can’t I use the populateViewHolder override method?

Why can’t I use the populateViewHolder override method?… here is a solution to the problem.

Why can’t I use the populateViewHolder override method?


tried retrieving data from the database in the fragment onViewCreated method, and I used the FirebaseRecylerAdapter shown below

    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

FirebaseRecyclerAdapter<AllUsers, AllUsersViewHolder> firebaseRecyclerAdapter;

public static class AllUsersViewHolder extends RecyclerView.ViewHolder {

View view;

public AllUsersViewHolder(View itemView) {
            view = itemView;

When I use firebaseRecyclerAdapter = new FirebaseRecyclerAdapter, it doesn’t give me the populateViewHolder method, it only provides the following method

FirebaseRecyclerAdapter<AllUsers, AllUsersViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<AllUsers, AllUsersViewHolder>() {
            protected void onBindViewHolder(AllUsersViewHolder holder, int position, AllUsers model) {


            public AllUsersViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
                return null;

Can anyone tell me why this is so


Firebase... The constructor of the Adapter class has changed in FirebaseUI version 3. Given this query:

Query query = FirebaseDatabase.getInstance()

If you are using version 3 or later, use FirebaseRecyclerOptions:

 FirebaseRecyclerOptions<model_class_name> options =
            new FirebaseRecyclerOptions.Builder<model_class_name>()
                    .setQuery(query, model_class_name.class)

Then declare a FirebaseRecyclerAdapter:

FirebaseRecyclerAdapter adapter = new FirebaseRecyclerAdapter<Chat, ChatHolder>(options) {

Add the variable options as described above. It is a variable of the FirebaseRecyclerOptions


Then to add an item, you must use onBindViewHolder, as it is the latest version of Firebase UI:

protected void onBindViewHolder(Holder holder, int position, model_class_name model) {
     Bind the class object to the holder
    // ...

For more information, check out:

Related Problems and Solutions