title: Populating Spinner from SQLite database using CursorAdapter
body: <p>I've looked at similar questions but they don't explain how to use a CursorAdapter.</p>
  
  <p>What I'm trying to do is populate a Spinner with a column of Strings read from a selected database.</p>
  
  <p>This is my current code:</p>
  
  <pre><code>//open database depending on selected item
  myDatabase = openOrCreateDatabase("Courses"+spSem.getSelectedItem().toString(),MODE_PRIVATE,null);
  
  
  //read fields to be populated and store them in an arraylist, I need to use arraylist since not every database has the same size
  Cursor resultSet = myDatabase.rawQuery("Select * from Subject",null);
  resultSet.moveToFirst();
  List&lt;String&gt; course = new ArrayList&lt;String&gt;();
  for (int i = 1; i &lt; course.size(); i++) {
      course.add(resultSet.getString(i));
  }
  </code></pre>
  
  <p>This next part is where I'm stuck, I'm thinking I need to use CursorAdapter() to populate the spinner, but I have no idea how? Previously I had this:</p>
  
  <pre><code>   String[] cArr = new String[course.size()];
      course.toArray(cArr);
      CursorAdapter a = new CursorAdapter(this,cArr,android.R.layout.simple_spinner_item);
      a.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      spCourse.setAdapter(a);
  </code></pre>
  
  <p>With this code I get the error "CursorAdapter is abstract and cannot be instantiated", and "cannot resolve method'setDropDownView'".</p>