title: Android ListView scrolling to top
body: <p>I have a <code>ListView</code> with custom rows.  When any of these rows is
  clicked, the ListView's data is regenerated.  I'd like the list to
  scroll back to the top when this happens.</p>
  
  <p>I initially tried using <code>setSelection(0)</code> in each row's <code>OnClickListener</code>
  to achieve this but was unsuccessful (I believe because the <code>ListView</code>
  loses its scroll position when its data is invalidated - so my call to
  setSelection is undone.  I still don't understand how the ListView
  decides where to scroll to after invalidation, though).</p>
  
  <p>The only working solution I know of was given by Romain Guy here:
  <a href="http://groups.google.com/group/android-developers/browse_thread/thread/127ca57414035301" rel="noreferrer">http://groups.google.com/group/android-developers/browse_thread/thread/127ca57414035301</a></p>
  
  <p>It involves (<code>View.post</code>)ing the call to <code>_listView.setSelection(0)</code>.  I
  found this to perform quite poorly.
  The newly generated list shows up with its scroll location unchanged
  and there is a considerable delay before it scrolls back to the top.</p>
  
  <p>Is there any better way to achieve this functionality?</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Thanks!</p>