Post description of my chat app not showing up

The post description of my chat app is not showing up rest other things are working fine.

The xml code-

<TextView
            android:id="@+id/postDesc"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:text="@string/this_is_post_description"
            app:layout_constraintEnd_toEndOf="@+id/timeAgo"
            app:layout_constraintStart_toStartOf="@+id/timeAgo"
            app:layout_constraintTop_toBottomOf="@+id/timeAgo" />

I made a class posts under the package Utills

package com.example.meetup.Utills;

 public class Posts {

private String datePost,postDesc, postImageUrl,userProfileImageUrl,username;

public Posts() {
}

public Posts(String datePost, String postDesc, String postImageUrl, String userProfileImageUrl, String username) {
    this.datePost = datePost;
    this.postDesc = postDesc;
    this.postImageUrl = postImageUrl;
    this.userProfileImageUrl = userProfileImageUrl;
    this.username = username;
}

public String getDatePost() {
    return datePost;
}

public void setDatePost(String datePost) {
    this.datePost = datePost;
}

public String getPostDesc() {
    return postDesc;
}

public void setPostDesc(String postDesc) {
    this.postDesc = postDesc;
}

public String getPostImageUrl() {
    return postImageUrl;
}

public void setPostImageUrl(String postImageUrl) {
    this.postImageUrl = postImageUrl;
}

public String getUserProfileImageUrl() {
    return userProfileImageUrl;
}

public void setUserProfileImageUrl(String userProfileImageUrl) {
    this.userProfileImageUrl = userProfileImageUrl;
}

public String getUsername() {
    return username;
}

public void setUsername(String username) {
    this.username = username;
}
}

This is my ViewHolder.java file

package com.example.meetup;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import org.jetbrains.annotations.NotNull;

import de.hdodenhof.circleimageview.CircleImageView;

public class MyViewHolder extends RecyclerView.ViewHolder {
CircleImageView profileImage;
ImageView postImage,likeImage,commentsImage;
TextView username,timeAgo,postDesc,likeCounter,commentsCounter;

public MyViewHolder(@NonNull @NotNull View itemView) {
    super(itemView);
    profileImage=itemView.findViewById(R.id.profileImagePost);
    postImage=itemView.findViewById(R.id.postImage);
    username=itemView.findViewById(R.id.profileUsernamePost);
    timeAgo=itemView.findViewById(R.id.timeAgo);
    postDesc=itemView.findViewById(R.id.postDesc);
    likeImage=itemView.findViewById(R.id.likeImage);
    commentsImage=itemView.findViewById(R.id.commentsImage);
    likeCounter=itemView.findViewById(R.id.likeCounter);
    commentsCounter=itemView.findViewById(R.id.commentsCounter);

  }
 }

This is my Load() everything works fine the post,username,everything just the post description (postDesc) is not showing up...

 private void LoadPost() {
    options=new FirebaseRecyclerOptions.Builder<Posts>().setQuery(postRef,Posts.class).build();
    adapter = new FirebaseRecyclerAdapter<Posts, MyViewHolder>(options) {
        @Override
        protected void onBindViewHolder(@NonNull MyViewHolder holder, int position, @NonNull Posts model) {
            holder.postDesc.setText(model.getPostDesc());
            String timeAgo = calculateTimeago(model.getDatePost());
            holder.timeAgo.setText(timeAgo);
            holder.username.setText(model.getUsername());
            Picasso.get().load(model.getPostImageUrl()).into(holder.postImage);
            Picasso.get().load(model.getUserProfileImageUrl()).into(holder.profileImage);

        }

And yes i m succesfully taking the description as input because it(post description text) is showing in my firebase.

Here you can see just the post description is missing



Read more here: https://stackoverflow.com/questions/68485899/post-description-of-my-chat-app-not-showing-up

Content Attribution

This content was originally published by Akshat kant at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: