Guys, Thanks so much for your suggestions. I had tried all of the notify* and invalidate* methods on the adapter and list to no avail. The easiest solution for me was removing the swapCursor( null ) call. After doing this, the "orphaned" views no longer persist and everything is working as expected.
Thanks guys! E On Sun, Dec 30, 2012 at 10:48 AM, Nobu Games <[email protected]>wrote: > I just checked the implementation of (Simple)CursorAdapter. Calling > swapCursor with argument null (instead of another cursor object) internally > calls notifyDataSetInvalidated. That is basically a "death sentence" for an > Adapter and signals to the ListView it belongs to that the data source > should not be used anymore. > > Why it seems to still be working erratically after setting a different > cursor object might have to do with an internal bug in ListView and its > view caching strategies. You just triggered a sequence of events that is > undefined or not allowed to happen in the framework. > > So you have three options: > > 1. Don't call swapCursor(null) > 2. If you want the ListView to be blank then call listView.setAdapter(null) > 3. Or temporarily let Adapter.getCount() return 0 and call > notifyDataSetChanged until the new cursor is loaded. > > > On Wednesday, December 19, 2012 9:23:25 PM UTC-6, Evan Ruff wrote: >> >> Hey guys, >> >> I'm having some funny issues with my ListViews. Generally, I have a >> ListView activity where the list view takes up the entire activity. The >> list views are using a custom SimpleCursorAdapter and are using the >> supportLoaderManager to load in the data. The Loaders are connected to >> Observers and the data can be changed by background services. I'm getting >> some weird behavior when the data changes. >> >> When the data changes, I am doing an adapter.swapCursor( null ) while the >> new data is loading. >> >> When the list gets shorter, I'm getting black areas where the previous >> views where, and sometime I'm getting ~ghosting of older views if the >> removed views are at the bottom of the list. Is there some way to enforce >> invalidation or removal of these views? >> >> Is there some step I'm missing? >> >> Thanks! >> >> E >> > -- > 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 > -- 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

