Get position of an item within a ListView?
<p>How would one find the position of a specific item within a ListView? (Populated by SimpleCursorAdapter).</p>

<p>The reason I ask: The listview is set to singleChoice mode. When the user closes and reopens the app, I'd like the user's selection to be remembered. </p>

<p>The way I've done it so far is when the user clicks on an item, the ID of the chosen item is saved to preferences. What I need to learn is how to reselect the item in the activity's onCreate method once it's been repopulated. </p>

<p>My code for saving the selected item's ID:</p>

<pre><code>    @Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Cursor c = (Cursor) l.getItemAtPosition(position);
    selectedItem = c.getLong(c.getColumnIndex("_id"));
}
</code></pre>

<p>(I've tried googling, but only seem to find how to get the position of the <em>selected</em> item)</p>

<p>Thanks!</p>
