Pick up an item from Recyclerview and associate one class to another

Asked

Viewed 114 times

0

The thing is, I’m making an app for reading books that is worth as a final note, and I want to do this: after registering a book, I would like to add comments on it. When touching an item from recyclerview, the app opens another Activity, to add a comment.

The problem is that by adding more than one book, when it opens the Activity of registration of comments, still shows the comment of the first book, and I think it would work by picking an item(book) from recyclerview and associating it with the registered comment. The problem is I don’t know how to do that. Could someone help me?

Note: To create the local database, I use the objectbox.

Project link Click here

  • You should have a Comment class and your Book class should be able to save a Comment list.

1 answer

0

You can use a Map to reference the information according to the recycleview item you clicked and retrieve the value through get(Key), thus creating a direct reference between the recycleview item and the comments belonging to it.

Or else you can pull from the bench joining the two Book information and your comments and the moment you feed the views feed also the comments.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.