Cursor not returning current row clicked in android listview
<p>Good day, could you please help me look and this code and tell me what am doing wrong. I have a listview from a Cursor Adapter but when i click on a row, it returns back the row above it and not the target row clicked. which leads to if you click on the first row, it crashes with a "cursor out of bound exception". But when i add the c.moveToFirst() just before the intent invocation and i click on the first row, it just does nothing. Please here is the code: </p>

<pre><code>public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long rowId) {

   c = adapter.retrieveRow(rowId);

 Intent edit = new Intent(this,Item.class);
 edit.putExtra(DBAdapter.KEY_ID, rowId);
edit.putExtra(DBAdapter.NAME, c.getString(c.getColumnIndex(DBAdapter.NAME)));
edit.putExtra(DBAdapter.START_DATE, c.getString(c.getColumnIndex(DBAdapter.START_DATE)));
startActivityForResult(edit, ACTIVITY_EDIT);
}
</code></pre>

<p>and here is the database method that is being called: </p>

<pre><code>public Cursor retrieveRow(long rowId) {
 String[] resultColumns = new String[] {NAME,START_DATE};
             Cursor row = db.query(true,DATABASE_TABLE, resultColumns, KEY_ID +"=" +rowId, null, null, null, null,null);
   if(row != null){
             row.moveToFirst();
   }
    return row;
   }
</code></pre>

<p>i tried changing it to a OnListItemSelected() but nothing happened, it did not return anything at all.I am using the new view and bind view method on the cursor adapter. thanks in advance.</p>
