I am working on app similar to LinkedIn and here I have some users already added to Firebase Database. Also every user can post or upload some content as well. Now am looking for a technique or code snippet that allows me to list the posts only to those who follow others. "For example: if am following you I'll be able to see your uploaded content in feeds or home screen". For listing out the posts am using Firebase Recycler Adapter and RecyclerView.

Below is my code for listing the posts:

public void onStart() {

    FirebaseUser user = mAuth.getCurrentUser();

    final String userID = user.getUid();

    Query query = myRef;

    FirebaseRecyclerOptions<PostInfo> options = new FirebaseRecyclerOptions.Builder<PostInfo>()
            .setQuery(query, PostInfo.class)

    FBRA = new FirebaseRecyclerAdapter<PostInfo, PostViewHolder>(options) {
        protected void onBindViewHolder(@NonNull final PostViewHolder holder, int position, @NonNull PostInfo model) {


                holder.setPostImage(model.getPostImage(), getActivity());



                holder.likeBtn.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {




        public PostViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int i) {

            View view = LayoutInflater.from(getActivity()).inflate(R.layout.post_card, parent, false);

            return new PostViewHolder(view);





Here are the Database screenshots:

Below is a user who has accepted my request which means I follow him now:

enter image description here

These are user posts:

enter image description here

I also thought of using orderByChild().equals("theFollower"), could not figured it out. How can achieve it? How only limited users i.e, only followers can see my posts?

Thanks a lot!

0 Answers