listview scrolls to top after editing entry
<p>I am trying to create a listview that when you click on an entry you may modify it and after hitting confirm it will still show the entry you just modified instead of scrolling to the top. </p>

<p>made advised changes and after leaving the edit activity it still scrolls to the top and does not find the correct scroll position. am i missing something?</p>

<pre><code>static int firstPosition = 0;

protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    Cursor c = mNotesCursor;
    ListView mListView = getListView();
    firstPosition = mListView.getFirstVisiblePosition();
    c.moveToPosition(position);
    Intent i = new Intent(this, QuoteEdit.class);
    i.putExtra(QuotesDBAdapter.KEY_ROWID, id);
    i.putExtra(QuotesDBAdapter.KEY_QUOTES, c.getString(
    c.getColumnIndexOrThrow(QuotesDBAdapter.KEY_QUOTES)));
    startActivityForResult(i, ACTIVITY_EDIT);
}
    public void onResume(int requestCode, int resultCode, Intent intent) {
ListView mListView = getListView();

if (mListView != null &amp;&amp; firstPosition &gt;= 0){
   mListView.scrollTo(0,firstPosition);
//  mListView.setSelection(firstPosition);

}

}
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
    try {
        super.onActivityResult(requestCode, resultCode, intent);
        Bundle extras = intent.getExtras();
        switch(requestCode) {
            case ACTIVITY_CREATE:
                String title = extras.getString(QuotesDBAdapter.KEY_QUOTES);
                mDbHelper.createQuote(title);
                break;
            case ACTIVITY_EDIT: 
                ListView mListView = getListView();
                Long rowId = extras.getLong(QuotesDBAdapter.KEY_ROWID);
                if (rowId != null) {
                    String editTitle = extras.getString(QuotesDBAdapter.KEY_QUOTES);
                    mDbHelper.updateQuote(rowId, editTitle);
                    mListView.setSelection(firstPosition);
                }
                fillData();
                break;
        }
    }
    catch (Exception ex){
        Context context = getApplicationContext();
        CharSequence text = ex.toString();
        int duration = Toast.LENGTH_LONG;

        Toast toast = Toast.makeText(context, text, duration);
        toast.show();
    }
}
</code></pre>
