title: Cannot fetch data from room database to Spinner
body: <p>This app is to fetch data from api.github.com/users and reflect on spinner </p>
  
  <p>I am getting data in logs on <code>Splash.java</code> but unable to reflect data on <code>Home.java</code></p>
  
  <p>MyAppDatabase.java</p>
  
  <pre><code>@Database(entities = {Users.class}, version = 1, exportSchema = false)
  public abstract class MyAppDatabase extends RoomDatabase {
          public abstract MyDao myDao();
      }
  </code></pre>
  
  <p>MyDao.java</p>
  
  <pre><code>@Dao
      public interface MyDao {
  
          @Insert(onConflict = OnConflictStrategy.REPLACE)
          void addUsers(Users users);
  
          @Query("SELECT * FROM Users")
          List&lt;Users&gt; getUsers();
  
          @Query("SELECT node_id FROM Users")
          List&lt;String&gt; getNodeId();
  
      }
  </code></pre>
  
  <p><code>getData()</code> on Splash.java</p>
  
  <pre><code>   public class Splash extends AppCompatActivity {
  
      MyAppDatabase myAppDatabase;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_splash);
  
          Handler handler = new Handler();
          handler.postDelayed(new Runnable() {
              @Override
              public void run() {
                  myAppDatabase = Room.databaseBuilder(getApplicationContext(), MyAppDatabase.class, "MyDao").allowMainThreadQueries().build();
  
  
                  //get data from webservice and store locally
  
                  getData();
              }
          }, 500);
      }
  
      private void getData() {
          //Creating a string request
          JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Config.DATA_URL, new Response.Listener&lt;JSONArray&gt;() {
              @Override
              public void onResponse(JSONArray response) {
  
                  Log.e("response", response.toString());
                  response.length();
                  for (int i = 0; i &lt; response.length(); i++) {
                      try {
                          JSONObject jsonObject = response.getJSONObject(i);
  
                          Users users = new Users();
  
                          //Set fields in Users object.
  
                          users.setLogin(jsonObject.getString(Config.TAG_Login));
                          users.setId(jsonObject.getString(Config.TAG_Id));
                          users.setNode_id(jsonObject.getString(Config.TAG_Node));
                          users.setAvatar_url(jsonObject.getString(Config.TAG_Avatar));
                          users.setGravatar_id(jsonObject.getString(Config.TAG_Gravatar_id));
                          users.setUrl(jsonObject.getString(Config.TAG_url));
                          users.setHtml_url(jsonObject.getString(Config.TAG_htmi_url));
                          users.setFollowers_url(jsonObject.getString(Config.TAG_Followers_url));
                          users.setFollowing_url(jsonObject.getString(Config.TAG_Following_url));
                          users.setGists_url(jsonObject.getString(Config.TAG_Gists_url));
                          users.setStarred_url(jsonObject.getString(Config.TAG_Starred_url));
                          users.setSubscriptions_url(jsonObject.getString(Config.TAG_Subscriptions_url));
                          users.setOrganizations_url(jsonObject.getString(Config.TAG_Organizations_url));
                          users.setRepos_url(jsonObject.getString(Config.TAG_Repos_url));
                          users.setReceived_events_url(jsonObject.getString(Config.TAG_Received_events_url));
                          users.setType(jsonObject.getString(Config.TAG_Type));
                          users.setSite_admin(jsonObject.getString(Config.TAG_Site_admin));
                          users.setEvents_url(jsonObject.getString(Config.TAG_events_url));
  
                          myAppDatabase.myDao().addUsers(users);
  
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
                  }
  
                  Intent intent = new Intent(Splash.this, Home.class);
                  // intent.putExtra("remember", "true");
                  startActivity(intent);
  
              }
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  Log.e("Volley", error.toString());
              }
          });
  
          RequestQueue requestQueue = Volley.newRequestQueue(this);
          jsonArrayRequest.setRetryPolicy(new DefaultRetryPolicy(
                  10000,
                  DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
                  DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
          requestQueue.add(jsonArrayRequest);
      }
  }
  </code></pre>
  
  <p><code>putData()</code> on <code>Home.java</code></p>
  
  <pre><code>  public class Home extends AppCompatActivity {
  
      MyAppDatabase myAppDatabase;
  
      //To add into spinner
      private ArrayList&lt;String&gt; userType;
  
      //List of users from Db
      List&lt;Users&gt; users;
  
      private  Spinner spinner;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_home);
  
          userType = new ArrayList&lt;&gt;();
  
          spinner = findViewById(R.id.sp_user_type);
  
          myAppDatabase = Room.databaseBuilder(getApplicationContext(), MyAppDatabase.class,"UsersDb").allowMainThreadQueries().build();
          //get data from Db and put into arrayList for spinner
  
          putData();
      }
  
      private void putData() {
  
          users =myAppDatabase.myDao().getUsers();
          userType.add("Select UserType"); //Dummy addition
  
          for(int i = 0; i &lt; users.size(); i++){
              userType.add(users.get(i).getType());
              Log.e("DistNames",users.get(i).getType());
          }
  
          users.size();
          spinner.setAdapter(new ArrayAdapter&lt;&gt;(Home.this, android.R.layout.simple_spinner_dropdown_item, userType));
      }
  }
  </code></pre>