Firebase Reutrn null对于RecyclerView

时间:2019-03-10 17:17:43

标签: android

Firebase在recyclerview中返回null ..layout显示,但在texview中显示null而不是文本。

public class model {
        private String CompanyName;
        private String PostDate;
        private String PostDeadLine;
        private String PostTitle;
        private String PostDescription;
        private String employe_image;
        private String PostLocation;

        public model(String companyName, String postDate, String postDeadLine, String postTitle, String postDescription, String employe_image, String postLocation) {
            this.CompanyName = companyName;
            this.PostDate = postDate;
            this.PostDeadLine = postDeadLine;
            this.PostTitle = postTitle;
            this.PostDescription = postDescription;
            this.employe_image = employe_image;
            this.PostLocation = postLocation;
        }

        public String getCompanyName() {

            return CompanyName;
        }

        public void setCompanyName(String companyName) {
            CompanyName = companyName;
        }

        public String getPostDate() {
            return PostDate;
        }

        public void setPostDate(String postDate) {
            PostDate = postDate;
        }

        public String getPostDeadLine() {
            return PostDeadLine;
        }

        public void setPostDeadLine(String postDeadLine) {
            PostDeadLine = postDeadLine;
        }

        public String getPostTitle() {
            return PostTitle;
        }

        public void setPostTitle(String postTitle) {
            PostTitle = postTitle;
        }

        public String getPostDescription() {
            return PostDescription;
        }

        public void setPostDescription(String postDescription) {
            PostDescription = postDescription;
        }

        public String getEmploye_image() {
            return employe_image;
        }

        public void setEmploye_image(String employe_image) {
            this.employe_image = employe_image;
        }

        public String getPostLocation() {
            return PostLocation;
        }

        public void setPostLocation(String postLocation) {
            PostLocation = postLocation;
        }



       public model(){

       }
    }

我不知道我在哪里缺少什么,请告诉我我可以解决的       公共PostsAdapter(上下文续,ArrayList模型,字符串AnotherUserId,字符串CurrentUserId){

        this.context = cont;
        this.PostDataList = models;
        this.AnotherUserUid=AnotherUserId;
        this.mCurrentUserUid=CurrentUserId;
       // this.mSwipeRefreshLayout=swiper;


    }

    @NonNull
    @Override
    public PostsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new PostsViewHolder(LayoutInflater.from(context).inflate(R.layout.posts_item_layout, parent, false));

    }

    @Override
    public void onBindViewHolder(@NonNull final PostsViewHolder holder, int position) {

        String title, location;
        title = PostDataList.get(position).getPostTitle();
        location = PostDataList.get(position).getPostLocation();
        holder.company_name.setText(PostDataList.get(position).getCompanyName());
        holder.potedDate.setText("Post Date\n" + PostDataList.get(position).getPostDate());
        holder.postDescp.setText("Responsibilites:" + PostDataList.get(position).getPostDescription());
        holder.postDeadline.setText("Deadline:\n" + PostDataList.get(position).getPostDeadLine());
        holder.postTitle.setText(title);
        holder.InternLoc.setText("Location: " + location);
        Picasso.get().load(PostDataList.get(position).getEmploye_image()).placeholder(R.drawable.anonymus).into(holder.comp_CirleImage);
            }
        });


    }




    @Override
    public int getItemCount() {
        return PostDataList.size();
    }

    public class PostsViewHolder extends RecyclerView.ViewHolder {
        private CircleImageView comp_CirleImage;
        private TextView company_name, potedDate, postTitle, postDeadline, postDescp, InternLoc;
        private Button Follow, upload;
        private ImageButton sendMessege;

        public PostsViewHolder(View itemView) {
            super(itemView);
            company_name = (TextView) itemView.findViewById(R.id.itemcompanyname);
            potedDate = (TextView) itemView.findViewById(R.id.itemposteddate);
            postTitle = (TextView) itemView.findViewById(R.id.item_titleofpost);
            postDeadline = (TextView) itemView.findViewById(R.id.deadline_of_post);
            postDescp = (TextView) itemView.findViewById(R.id.itemdescription);
            InternLoc = (TextView) itemView.findViewById(R.id.itempostlocation);
            Follow = (Button) itemView.findViewById(R.id.itembtnfollow);
            upload = (Button) itemView.findViewById(R.id.itembtnuploadcv);
            sendMessege=(ImageButton)itemView.findViewById(R.id.messegeImgBtn);
            comp_CirleImage = (CircleImageView) itemView.findViewById(R.id.posts_item_circleImage);


        }

enter image description here

0 个答案:

没有答案