How to compare PagingData to Local Database in MVVM [Android]

182 Views Asked by At

Hey there i have a bottom navigation view and multiple fragments to be exact 3 of them what they do->

  1. Home -> Shows random images from a paginated api with a heart icon based on if its saved
  2. Search -> Searches for images with a query from a paginated api with a heart icon based on if its saved
  3. Saved-> Shows Saved images with an active heart icon

My issue is that when i get data from a paginated api i compare it to the data in paging resource and it works fine but When i save a image and go to saved fragment and unsave it on the home it still shows saved which is right based on logic but i can't find any other way to solve this other than giving a database access to adapter but that is again against mvvm

i am using a room database paging 3 library and mvvm architecture pattern

0

There are 0 best solutions below