How to fetch data from database instead of JSON everytime
<p>Actually, I followed <a href="https://www.youtube.com/watch?v=ObU-wCqoo2I" rel="nofollow">this YouTube tutorial</a> and got an idea of delivering articles from a WordPress blog using the JSON API. </p>

<p>Here is the <a href="https://github.com/filippella/Retrofit2-RestApiDemo" rel="nofollow">GITHUB</a> link.</p>

<p>The above tutorial has a good example, but it only shows data from database only when there is no internet connection available. But I want the following:</p>

<ol>
<li>Fetch data when the app is first started.</li>
<li>Store the data in the database</li>
<li>Set the adapter and show the data in the recyclerview</li>
<li>When the app is loaded for the second time check if internet is available and then check for new data, download if available, and then save the data into database and show the data in the recycler view.</li>
</ol>

<p>Now, I've developed most of the logic for it, but the tutorial has used some advanced OOPs principles of JAVA which I am unable to fully comprehend. 
Can anyone please help me and tell me how I can change the given code and display the data from database even if internet is available or not? </p>