title: How to retrieve data from Room SQLite database?
body: <p>So I have created a room database following tutorials on youtube. I have two columns day and likes, each holding int's. Currently I have populated the database manually with three rows of data.</p>
  <p>Here is the code for populating database manually:</p>
  <pre><code>@Database(entities = Recovery.class, version = 1, exportSchema = false)
  public abstract class RecoveryDatabase extends RoomDatabase {
  
  private static RecoveryDatabase INSTANCE;
  public abstract RecoveryDao recoveryDao();
  
  // Singleton
  public static RecoveryDatabase getInstance(final Context context) {
      if (INSTANCE == null) {
          synchronized (RecoveryDatabase.class) {
              if (INSTANCE == null) {
                  INSTANCE = Room.databaseBuilder(context.getApplicationContext(), RecoveryDatabase.class, &quot;recovery_database&quot;).fallbackToDestructiveMigration().addCallback(roomCallback).build();
              }
          }
      }
      return INSTANCE;
  }
  
  private static RecoveryDatabase.Callback roomCallback = new RoomDatabase.Callback() {
      @Override
      public void onCreate(@NonNull SupportSQLiteDatabase db) {
          super.onCreate(db);
          new PopulateDbAsyncTask(INSTANCE).execute();
      }
  };
  
  private static class PopulateDbAsyncTask extends AsyncTask&lt;Void, Void, Void&gt; {
      private RecoveryDao recoveryDao;
  
      private PopulateDbAsyncTask(RecoveryDatabase db) {
          recoveryDao = db.recoveryDao();
      }
  
      @Override
      protected Void doInBackground(Void... voids) {
          // First input is the day and the second is the num of likes for that day
          recoveryDao.insert(new Recovery(6,1));
          recoveryDao.insert(new Recovery(7,2));
          recoveryDao.insert(new Recovery(8,3));
          return null;
      }
  }
  </code></pre>
  <p>}</p>
  <p>In my Dao class I currently have Insert, Update, deleteAll, and getAll... Methods.
  Here is the Dao:</p>
  <pre><code>@Dao
  public interface RecoveryDao {
  
  @Insert
  void insert(Recovery recovery);
  
  @Update
  void update(Recovery recovery);
  
  
  @Query(&quot;DELETE FROM recovery_table&quot;)
  void deleteAllRecovery();
  
  // Sends data from ascending day to the call. (1,2,3,4 ....)
  @Query(&quot;SELECT * FROM RECOVERY_TABLE ORDER BY day ASC&quot;)
  LiveData&lt;List&lt;Recovery&gt;&gt; getAllRecovery();
  </code></pre>
  <p>}</p>
  <p>Now, I want to retrieve the data from the Room database based on the day. So I want the num of likes for day 6, which would be 1. I want to retrieve the data and store it into an int variable in mainActivity.</p>
  <p>So my end goal is the have many rows of data in the database and retrieve that and store that into an ArrayList, but I must first figure out how to retrieve data first.</p>
  <p>I have tried many solutions from stackover flow, but I have not yet figured it out. All tutorials on YT all use Recycler view and adapters, but I will not be using them.
  I am very new to sqlite and MVVM. Thank you for the help!!!</p>