Insert first column spinner into a table
<p>I've a table (Categories) wich two columns (_id, name).</p>

<p>I've a spinner that shows the column name. </p>

<p>Now, I need to insert the column: "_id" into another table...but I don't know how to do it.</p>

<p>Any suggestions?</p>

<hr>

<p>I paste the code I'm using:</p>

<pre><code>public Cursor recuperaCategoria()
    {
    final UsuariosSQLiteHelper usdbh =new UsuariosSQLiteHelper(this, "DBLlistaCompra", null, 1);
    final SQLiteDatabase db = usdbh.getWritableDatabase();
    String tableName = "Categorias";
    String[] columns = {"_id","Nombre"};

    return db.query(tableName, columns, null, null, null, null, null);
    }

public void recCatSpinner() {
        final Spinner addCatSpinner = (Spinner) findViewById(R.id.spIdCategoria);
        catCursor = recuperaCategoria();
        catCursor.moveToPosition(1);
        catAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item);  
        addCatSpinner.setAdapter(catAdapter);
        if (catCursor.moveToFirst()) { 
          do { 

             catAdapter.add(catCursor.getString(1)); 
             Valor = catCursor.getString(1); 
             Log.v("valor Add Cat 100", Valor);
         } 
          while (catCursor.moveToNext()); 
            int id = catCursor.getInt(0);
            String name = catCursor.getString(1);

          Log.v("Dentro cursor","1");
          if (db != null) { 
          Toast.makeText(getBaseContext(),catCursor.getString(0),Toast.LENGTH_SHORT).show();

          db.close(); 
          } 
        } 
        startManagingCursor(catCursor);
        //catCursor.close();
        addCatSpinner.setOnItemSelectedListener(
                new AdapterView.OnItemSelectedListener() {
                    public void onItemSelected(AdapterView&lt;?&gt; parent,
                        View view2, int pos, long id) {
                        //recID();
                        valor = parent.getItemAtPosition(pos).toString();
                        Log.v("valor Add Cat", valor);

                        }
                  public void onNothingSelected(AdapterView&lt;?&gt; parent) {
                       // view.setText("nada");
                    }
                });
        catCursor.close();
}
</code></pre>

<p>I'd like that when I select one item from spinner (it shows the column "Nombre"), I save into one variable the first column from cursor "_id".</p>
