Cursor to Int Conversion
<p>I am having some trouble converting the results of a query into an integer. I am returning the results of the query into a cursor and trying to use this value again in another statement. I know the value being returned is an int but I cant seem to extract the value into an integer variable. I have also tried returning the statement into an int but that doesnt work either. </p>

<p><strong>Query</strong></p>

<pre><code>public Cursor getCode(String name) throws SQLException
{
    return db.rawQuery("select recipe_code from recipes where recipe_name = " + "'"+name+"'" ,null);
}
</code></pre>

<p><strong>Int conversion NOW WORKING</strong></p>

<pre><code>    Cursor code = adapter.getCode(string);
    code.moveToFirst();
    int test = code.getInt(0);
</code></pre>