title: Android Firebase - Display data in RecyclerView Adapter inside Fragment
body: <p>This is my database.</p>
  
  <pre><code>`{
    "users" : {
      "post" : {
        "3kcjEiWdeic2HLuWk7WooVpyXHQ2" : {
          "19:19:13 2019-02-23" : {
            "description" : "some description",
            "photoUrl" : "https://firebasestorage.googleapis.com/v0/b/revoney-c5ada.appspot.com/o/3kcjEiWdeic2HLuWk7WooVpyXHQ2%2FImages%2FImg20190223_191905.jpg?alt=media&amp;token=4e3c81b7-4df0-4c04-aa2d-5554ceecf1c2",
            "title" : "some title"
          },
          "19:27:23 2019-02-23" : {
            "description" : "jhhghjjnn",
            "photoUrl" : "https://firebasestorage.googleapis.com/v0/b/revoney-c5ada.appspot.com/o/3kcjEiWdeic2HLuWk7WooVpyXHQ2%2FImages%2FImg20190223_192702.jpg?alt=media&amp;token=09c3ce5a-9b9f-4168-823c-f816fc99d7fd",
            "title" : "ygggyujj"
          }
        }
      }
    }
  }`
  </code></pre>
  
  <p>This is my adapter class where I inflate the views to show the photos and the information.</p>
  
  <pre><code>    public class RecyclerHomeAdapter extends RecyclerView.Adapter&lt;RecyclerHomeAdapter.ItemDataViewHolder&gt;{
  
      List&lt;HomeObject&gt; data;
  
      public RecyclerHomeAdapter(List&lt;HomeObject&gt; data) {
          this.data = data;
      }
  
      @NonNull
      @Override
      public ItemDataViewHolder onCreateViewHolder(@NonNull ViewGroup parent, final int viewType) {
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.home_row, parent, false);
          ItemDataViewHolder holder = new ItemDataViewHolder(view);
  
               return holder;
  
      }
  
      @Override
      public void onBindViewHolder(@NonNull final ItemDataViewHolder holder, final int position) {
  
          final HomeObject homeObject = data.get(position);
  
          holder.usernameHomeTextView.setText(homeObject.getNameUser());
          holder.descriptionHomeTextview.setText(homeObject.getDescription());
          holder.commentsHomeTextview.setText(homeObject.getComments());
          holder.likesHomeTextView.setText(homeObject.getLikes());
  
  
          Picasso.get().load(homeObject.getPhotoProfile()).fit().centerCrop()
                  .rotate(270).noFade().into(holder.profilePhotoHomeImageView);
  
          Picasso.get().load(homeObject.getPhotoUrl()).fit().centerCrop()
                  .rotate(270).noFade().into(holder.postPhotoImageView);
  
          Picasso.get().load(homeObject.getPhotoProfile()).fit().centerCrop()
                  .rotate(270).noFade().into(holder.descriptionPhotoHomeImageView);
  
  
  
      }
  
      @Override
      public int getItemCount() {
          return data.size();
      }
  
  
      public class ItemDataViewHolder extends RecyclerView.ViewHolder{
  
      ImageView profilePhotoHomeImageView, postPhotoImageView, likesHomeImageView,commentsHomeImageView;
      ImageView  followHomeImageView, helpHomeImageView, descriptionPhotoHomeImageView;
      TextView usernameHomeTextView,descriptionHomeTextview,commentsHomeTextview,likesHomeTextView;
      Button purchasseHomeButton;
  
      public ItemDataViewHolder(View itemView) {
          super(itemView);
  
          profilePhotoHomeImageView = itemView.findViewById(R.id.profilePhotoHomeImageView);
          postPhotoImageView = itemView.findViewById(R.id.postPhotoImageView);
          likesHomeImageView = itemView.findViewById(R.id.likesHomeImageView);
          commentsHomeImageView = itemView.findViewById(R.id.commentsHomeImageView);
          followHomeImageView = itemView.findViewById(R.id.followHomeImageView);
          helpHomeImageView = itemView.findViewById(R.id.helpHomeImageView);
          descriptionPhotoHomeImageView = itemView.findViewById(R.id.descriptionPhotoHomeImageView);
          usernameHomeTextView = itemView.findViewById(R.id.usernameHomeTextView);
          descriptionPhotoHomeImageView = itemView.findViewById(R.id.descriptionPhotoHomeImageView);
          descriptionHomeTextview = itemView.findViewById(R.id.descriptionHomeTextview);
          commentsHomeTextview = itemView.findViewById(R.id.commentsHomeTextview);
          purchasseHomeButton = itemView.findViewById(R.id.purchasseHomeButton);
          likesHomeTextView = itemView.findViewById(R.id.likesHomeTextView);
      }
  }
      }
  </code></pre>
  
  <p>This is the fragment where I want to display the posts.</p>
  
  <pre><code>    public class HomeFragment extends Fragment {
  
      // Write a message to the database
      FirebaseDatabase database;
      DatabaseReference mRef;
      StorageReference storageRef;
      FirebaseStorage storage;
      FirebaseAuth auth;
      RecyclerView rv;
      List&lt;HomeObject&gt; data;
      RecyclerHomeAdapter adapter;
      HomeObject homeObject;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.fragment_home, container, false);
  
          rv = view.findViewById(R.id.home_recycler);
  
          auth = FirebaseAuth.getInstance();
          storage = FirebaseStorage.getInstance();
          storageRef = storage.getReference();
  
          //RETRIEVE IMAGES
          homeObject = new HomeObject();
  
          rv.setLayoutManager(new LinearLayoutManager(getContext()));
          data = new ArrayList&lt;&gt;();
  
          adapter = new RecyclerHomeAdapter(data);
          rv.setAdapter(adapter);
  
          return view;
      }
  
      @Override
      public void onStart() {
          super.onStart();
  
          final FirebaseDatabase database = FirebaseDatabase.getInstance();
          DatabaseReference ref = database.getReference("Users/Post");
  
          ref.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  
                  data.clear();
                  for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
                      HomeObject post = postSnapshot.getValue(HomeObject.class);
                      data.add(post);
                  }
                  adapter.notifyDataSetChanged();
  
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError databaseError) {
  
              }
          });
      }
  }
  </code></pre>
  
  <p>I've tried to display the posts but without any fortune. I'm trying to recover firebase data and display it in a recyclerview adapter inside fragment. Can someone help me?</p>