0

I have firstactivity that has recycler view and recyclerview item contains imageview and one button of favourite.and on click on button i have to call api of mark and unmark favourite.and on click on image i am opening different activity,and this second activity also has option to mark and unmark favourite.I am able to do this all.but my question is if i am calling mark fvrt from second activity,it should be updated on first activity. I am managing mark and unmark from boolean value.but onResume of first activity i need to update that paricular item.Calling api is not solution of this.So what should i do.

user7108398
  • 91
  • 1
  • 1
  • 8
  • going to have to show a bit of code so we can see what you're actually trying to do I feel like i know whats wrong but cant tell for sure if I cant see anything – Brent Jul 24 '19 at 19:42

1 Answers1

0

You can use custom listener to detect which item changed and notify this item, check this link please to create custom listener How to create our own Listener interface in android?

Or

You can call the Api in onResume()

  1. Call api in onResume()
  2. Set recyclerView.setItemAnimator(null); (Optional)
  3. Clear RecyclerView items
  4. Set new data
Mahmoud Waked
  • 357
  • 2
  • 8