g0labi g0labi - 4 months ago 36x
JSON Question

How can I add RecyclerView row to the WishList

I need to Implement WishList like a google play in my app .In the each row of my

in the
, I have a one Button (Heart Icon). I

want when this heart icon clicked ,This row of
Add to wishlist Activity .

I know that , I should save this entry with
of Heart button in

the database and show entries with
In the wish list activity , But my

RecyclerView Populate with Json Data and Image and it have a download link

(download with android download manager)

know my question :

what is the best practice for this work ?

1.save the json data in the database and showing that

or ... (do you have a suggestion)?



You have multiple options, the option to put the data in the database when the onClickListener for that specific item is called seems like the best option to me. Altho, don't forget to notify the Adapter the clicked item has to be redrawn by calling notifyDataSetChanged() or notifyItemChanged(position).

You can also add a callback listener to your RecyclerView's Adapter which can return the clicked item to the Activity, but this will only make things more complicated and there is no need to do this.