title: Listview not filled with data from Volley in onCreate
body: <p>I'm trying to generate a list view from data together with Volley and ORMLite. The data is shown when i perform a pull to refresh or a reload of the page. When I reload the page I'm using a updateUI() function: </p>
  
  <pre><code> private void updateUI() throws SQLException {
      mAdministrationList.clear();
      mAdminstrationAdapter = new AdministrationAdapter(this, getLayoutInflater(), mAdministrationList);
      mVolleyHandler.GETAdministrations();
      mAdministrationList = mAdministrationDao.queryForAll();
  
  
      mAdminstrationListView.setAdapter(mAdminstrationAdapter);
      mAdminstrationListView.setOnItemClickListener(this);
      mAdminstrationAdapter.notifyDataSetChanged();
  }
  </code></pre>
  
  <p>This function works but the list is, as mentioned above, only loaded on a pull to refresh. </p>
  
  <p>My onCreate looks like this:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_administration);
  
      mAdminstrationListView = (ListView) findViewById(R.id.administrationListView);
  
      mProgressSpinner = (ProgressBar) findViewById(R.id.administration_spinner);
  
      try {
          mAdministrationDao = getHelper().getAdministrationDao();
          mGlobalsDao = getHelper().getGlobalsDao();
          mGlobals = mGlobalsDao.queryForAll().get(0);
  
          mCurrentAdministration = mGlobals.getAdministration();
          mToken = mGlobals.getToken();
          mUser = mGlobals.getUser();
  
          mVolleyHandler = VolleyHandler.getInstance(this, mGlobals.getIpAddress(), mCurrentAdministration, mUser, mToken);
  
          updateUI();
          mAdminstrationAdapter.notifyDataSetChanged();
      } catch (SQLException e) {
          e.printStackTrace();
      }
  
      mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.administrationSwipe);
      mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
              try {
                  updateUI();
  
                  mAdminstrationAdapter.notifyDataSetChanged();
              } catch (SQLException e) {
                  e.printStackTrace();
              }
  
              mSwipeRefreshLayout.setRefreshing(false);
          }
      });
  }
  </code></pre>
  
  <p>The VolleyCall I'm making is getting the data from the API and parse it to a Administration Object, who is getting saved to the Database with ORMLite. </p>
  
  <pre><code>  public void ParseAdministration(String response) throws JSONException, SQLException {
      JSONObject jsonObject = new JSONObject(response);
      JSONArray results = jsonObject.getJSONArray("results");
  
      for (int i = 0; i &lt; results.length(); i++) {
  
          JSONObject object = results.getJSONObject(i);
  
          Administration administration = new Administration();
          administration.setId(Long.valueOf(object.getString("id")));
          administration.setName(object.getString("name"));
          administration.setAddress1(object.getString("address1"));
          administration.setAddress2(object.getString("address2"));
          administration.setPostalCode(object.getString("postalCode"));
          administration.setCity(object.getString("city"));
          administration.setCountry(object.getString("country"));
  
          mDatabaseHelper.saveAdministration(administration);
  
      }
  }
  </code></pre>
  
  <p>I can't find where the problem is, so maybe some of you know what my problem is. </p>
  
  <p>Thanks in Advance</p>
  
  <p>EDITED:</p>
  
  <p>Thanks to Shubham Goel, I have found a solution:</p>
  
  <pre><code> new Handler().postDelayed(new Runnable() {
              @Override
              public void run() {
                  try {
                      mProgressSpinner = (ProgressBar) findViewById(R.id.administration_spinner);
                      updateUI();
                  } catch (SQLException e) {
                      e.printStackTrace();
                  }
  
                  mProgressSpinner.setVisibility(View.GONE);
              }
          }, 3000);
  </code></pre>
  
  <p>Maybe it's a little bit dirty but it does the job. Let me know if you think there is a better solution :)</p>