title: Spinner items not showing at first time
body: <p>I have  activities- <strong>StartupActivity</strong> and <strong>MainActivity</strong>.</p>
  
  <p>In StartupActivity i am inserting some data in a table and staring the MainActivity by using intent. </p>
  
  <p>Code inside <strong>StartupActivity</strong> :</p>
  
  <pre><code>db.addFriend("userNameTest"); //db is a DataBase handler class and has been initialized inside onCreate()
  Intent home = new Intent(StartUp.this, MainActivity.class);
  startActivity(home);
  finish();
  </code></pre>
  
  <p>Data is inserting successfully, as i can see them in the DB table. Also, MainActivity is starting properly.</p>
  
  <p>Inside MainActivity i am retrieving the data from table and showing in a spinner.</p>
  
  <p>Code inside onCreate method of <strong>MainActivity</strong> :</p>
  
  <pre><code> List&lt;String&gt; list = db.getFriends();
  
   dataAdapter = new ArrayAdapter&lt;String&gt;(this,
                  android.R.layout.simple_spinner_item, list);
   dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
   friendSpinner.setAdapter(dataAdapter);
   friendSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
                  @Override
                  public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int position, long id)
                         { String frnd_name = (String)dataAdapter.getItem(position); }
                  @Override
                  public void onNothingSelected(AdapterView&lt;?&gt; adapter) {  }
              });
  </code></pre>
  
  <p>Spinner is not showing any data for the first time but if i press back button and than again navigate back to the activity it shows data in spinner. Plus, it only dosent show data when first run at installation time; after that for each run it shows data.</p>
  
  <p>What can be the reason for this? Help me out please.</p>
  
  <p>Another thing will be also helpful. if i add some data in the table and than try to refresh the dataAdapter of spinner or spinner itself. How am i going to do that? For now, i am just using the above code again; as i have tried dataAdapter.notifyDataSetChanged();- which isn't working.</p>