0

I'm a beginner in developing android

I create a news feed where you can comment on posts, to do this I use firebase as a database and I use FirebaseRecyclerAdapter and FirebaseRecyclerOptions

I want the user to click on the "Comment" button of the first RecyclerView

The second RecyclerView displays the comments according to the post clicked.

I have no idea how to do this, knowing that I tried by capturing the position of the post.

Thank you. Thank you.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • 1
    Welcome to SO, Please post the code that you tried, it would make your question more genuine and more likely to be answered. – PradyumanDixit Nov 15 '18 at 03:39

1 Answers1

0

The first thing you'll need to do is record what pot the user clicked on. If you're using the Realtime Database, I recommend doing that by recording the key of the item that they clicked on. For some hints on how to do that, see:

Next up, you need to pass that key to the second recycler view somehow.

If the two recycler views are in the same activity, you can use a member field to store the comment that was clicked.

If the two recycler views are in separate activities, you can store the key in Android's shared preferences. For more on this data transfer mechanism, see:

Finally, you'll need to use the key to load the comments for that specific post. This depends on your exact data structure, but I recommend starting with the documentation on working with lists of data or FirebaseUI, similar to what you likely already have.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807