I'm try to retrieve datafrom database in my fragment onViewCreated method I have used FirebaseRecylerAdapter like 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 wont give me the populateViewHolder method just give method like below

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 someone please tell me why this is happening

Solution 1

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

Query query = FirebaseDatabase.getInstance()

If you're using a version 3 or higher, you 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 above. It is the variable of the class FirebaseRecyclerOptions

Then to add items you have to use onBindViewHolder since its 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 info check this: