• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

currently i have been using these types of codes and i am using setter and getter method from module

Vora Ravi

Lurker
Code:
private DatabaseReference PostRef;
       query sortPost=PostRef;
       enter code hereFirebaseRecyclerOptions<Post> options=new FirebaseRecyclerOptions.Builder<Post>().setQuery(sortPost,Post.class).build();
   [USER=1021285]@override[/USER]
               protected void onBindViewHolder(@NonNull  PostsViewHolder holder, int position, @NonNull final Post model)
               {
                   final String PostKey=getRef(position).getKey();//get key by this line

                   PostRef.addValueEventListener(new ValueEventListener()
                   {
                       [USER=1021285]@override[/USER]
                       public void onDataChange(@NonNull DataSnapshot dataSnapshot)
                       {
                           uidOfPostUser= dataSnapshot.child(PostKey).child("uid").getValue().toString();
                       }

                       [USER=1021285]@override[/USER]
                       public void onCancelled(@NonNull DatabaseError databaseError) {

                       }
                   });

                   holder.username.setText(model.getFullname());
 

Attachments

  • 1.png
    1.png
    13.1 KB · Views: 182
Last edited by a moderator:
Back
Top Bottom