title: ListView Requires 2 setSelection's to Scroll to Item
body: <p>Peculiar problem I'm having with a cursoradapter in a listfragment.</p>
  
  <p>In my onLoadFinished I select the previously selected item in order to scroll the listview to the previous position (and then highlight that item).</p>
  
  <p>This works splendidly, except for the scrolling part.  </p>
  
  <p><strong>If I just use one post and delay it (even say 5 seconds), the item gets selected but the list will not scroll (the selected item may out of view at this time)</strong>  With or without delay same behavior with just one post.</p>
  
  <p>I have to post setSelection AGAIN to get the listview to scroll so the selected item is in view.  </p>
  
  <p>It doesn't matter how long I delay the initial or second scroll post.  </p>
  
  <p>Here's my grubby workaround, but I'm not pleased with it.  Any ideas?</p>
  
  <pre><code>@Override
  public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor data) {
      mAdapter.swapCursor(data);
      getListView().post(new Runnable() {
          @Override
          public void run() {
              getListView().requestFocusFromTouch();
              getListView().setSelection(selectedposition);
              getListView().performItemClick(getListView().getAdapter().getView(selectedposition, null, null), selectedposition, selectedid);
              getListView().clearFocus();
          }    
      });
      getListView().postDelayed(new Runnable() {
          @Override
          public void run() {
              getListView().requestFocusFromTouch();
              getListView().setSelection(selectedposition);
              getListView().performItemClick(getListView().getAdapter().getView(selectedposition, null, null), selectedposition, selectedid);
              getListView().clearFocus();
          }    
      }, 500);
  }
  </code></pre>