On Thu, Jul 8, 2010 at 4:20 PM, Mark Murphy <[email protected]> wrote:
> On Thu, Jul 8, 2010 at 3:14 PM, Connick <[email protected]> wrote: > > My user has a menu option to jump from a list activity to a preference > > screen which has options for filtering and/or sorting visible data in the > > aforementioned list activity. When the user hits the back button, inside > > onResume() I am calling cursor.managedQuery() with the new sort/filter > > params. > > > There is no managedQuery() method on a Cursor, AFAIK. > > Oops, sorry I meant to say I was setting the cursor = managedQuery( ...new where clause etc ...) Cursor cursor; MyCursorAdapter adapter; onCreate(){ refresh(); adapter = new MyCursorAdapter( this, cursor ); setListAdapter( adapter ); } onResume(){ refresh() } refresh(){ // read prefs, build new where clause cursor = managedQuery( ...new where clause etc ...) } I guess I can understand why this is happening ...data isn't actually changing, just the contents of the cursor. > The only workaround I've found so far is to > > re-create the adapter onResume ...which obviously isn't the best approach > as > > I lose scroll position etc > > > If I change sort or filter conditions, as a user I would expect to be > > taken to the top of the list, since the previous scroll position is > > meaningless. > > For a sort, absolutely ..but if I'm re-setting the adapter then when the user drills down (versus jumping to preferences) then hits back, the scroll position is also reset. Perhaps a compromise would be to fire a broadcast from prefs that resets the adapter on the list. Then drill down and back won't be affected. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

