title: Data Not Showing from database to Spinner
body: <p>I am developing a small app in which i have to used a spinner with database. I am using </p>
  
  <pre><code>   spinner.setOnItemSelectedListener(this);
       loadSpinnerData();
  </code></pre>
  
  <p>My loadSpinnerData() is below</p>
  
  <pre><code>        private void loadSpinnerData() {
          // database handler
       AndroidContext.setContext(this);
  
          sqlitedatabase_obj = DatabaseHelper.getInstance().getDb();
  
          // Spinner Drop down elements
           DatabaseHelper db = new DatabaseHelper(getApplicationContext());
          List&lt;String&gt; lables = db.getAllLabels();
  
          // Creating adapter for spinner
          ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_spinner_item, lables);
  
          // Drop down layout style - list view with radio button
          dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  
          // attaching data adapter to spinner
          spinner.setAdapter(dataAdapter);
      }
  </code></pre>
  
  <p>getAllLabels is define in DatabaseHelper class</p>
  
  <pre><code>                public List&lt;String&gt; getAllLabels(){
      List&lt;String&gt; labels = new ArrayList&lt;String&gt;();
  
      // Select All Query
      String selectQuery = "SELECT _id, product_name  FROM list_create WHERE _id = ?";
  
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor cursor = db.rawQuery(selectQuery, null);
  
      // looping through all rows and adding to list
      if (cursor.moveToFirst()) {
          do {
              labels.add(cursor.getString(1));
          } while (cursor.moveToNext());
      }
  
      // closing connection
      cursor.close();
      db.close();
  
      // returning lables
      return labels;
  }
  </code></pre>
  
  <p>I want to show dynamic spinner with data from database. But i am not able to populate data from data base even i did not get and exception or error .</p>