On Thu, Jul 8, 2010 at 4:45 PM, Connick <[email protected]> wrote:
> 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.

It's not even that -- you're creating a brand-new Cursor.

> 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.

You can use registerOnSharedPreferenceChangeListener()

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
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

Reply via email to