Fill spinner from cursor in android
<p>i have searched for a awnser for this for a while today. It all looks so easy but i never get it to work. I want to fill a spinner with my cursor. I have been trying to use SimpleCursorAdapter for this as a lot of sites say i shall but i never get it to work. Show me just how easy it is :)</p>

<p>Thanks for your time!</p>

<p>My cursor</p>

<pre><code>Cursor cursor = db.query(DATABASE_TABLE_Clients, new String[] {"_id", "C_Name"}, null, null, null, null, "C_Name");
</code></pre>

<p>My spinner</p>

<pre><code>(Spinner) findViewById(R.id.spnClients);
</code></pre>

<p>My Code</p>

<pre><code>Cursor cursor_Names = SQLData.getClientNames();
startManagingCursor(cursor_Names);

String[] columns = new String[] { "C_Name" };
int[] to = new int[] { R.id.txt_Address };

SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_dropdown_item, cursor_Names, columns, to);
Spinner spnClients = (Spinner) findViewById(R.id.spnClients);
spnClients.setAdapter(mAdapter);
</code></pre>
