Here's what I am trying to do.
I have 2 fragments hosted in MainActivity.
Fragment 1 has just a couple of widgets to update. Fragment 2 has a recycler view to display the list of items.
I first get an instance of the data class and call its fetchData method.
The fetchData() method communicates with the local database to first see if my data is already stored in my local database.
If it is stored, then it simply returns that data and the recycler view in fragment 2 simply display that data.
But the problem arises when I have to fetch fresh data from the internet if data in my local database is not already present which is an asynchronous call. (The library I am using to call web API is Volly)
Now I am confused how to tell Fragment 1 and Fragment 2 to use the updated data once the database is updated?