[android-beginners] Re: Best way to reposition contents of ListView at the top?

2009-10-08 Thread westmeadboy
I notice that if setSelection(0) is called just before notifyDataSetChanged() it doesn't work - i.e. its as if setSelection (0) didn't do anything. However, switching the calls around works for me. On Oct 9, 11:49 am, Romain Guy wrote: > > 1. Does this still work if the list is empty? The docs

[android-beginners] Re: Best way to reposition contents of ListView at the top?

2009-10-08 Thread Romain Guy
> 1. Does this still work if the list is empty? The docs don't specify. Yes. > 2. Is this better than just resetting the adapter? Much much much much much more efficient. > > On Oct 9, 11:27 am, Romain Guy wrote: >> setSelection(0) >> >> On Thu, Oct 8, 2009 at 8:14 PM, westmeadboy wrote: >>

[android-beginners] Re: Best way to reposition contents of ListView at the top?

2009-10-08 Thread westmeadboy
Thanks. 1. Does this still work if the list is empty? The docs don't specify. 2. Is this better than just resetting the adapter? On Oct 9, 11:27 am, Romain Guy wrote: > setSelection(0) > > On Thu, Oct 8, 2009 at 8:14 PM, westmeadboy wrote: > > > I have a ListView which displays the results of

[android-beginners] Re: Best way to reposition contents of ListView at the top?

2009-10-08 Thread Romain Guy
setSelection(0) On Thu, Oct 8, 2009 at 8:14 PM, westmeadboy wrote: > > I have a ListView which displays the results of some search. > > When the user makes a new search I repopulate the underlying Array of > an ArrayAdapter and call notifyDataSetChanged(). However, if the user > has previously s