Hello, I've got a Listview in my activity with a cursor adapter and a view to render the results.
When i return a rather large data set from my query (like say, 15,000 rows), the Listview.setadapter() call blocks on me and occasionally gives me the dreaded ANR dialog. I've tried various ways to background the operation. Fetch the cursor in a background thread, but that is a rather short operation since it just returns a handle to the underlying dataset. Obviously I can't background the loading of the adapter in the thread because the setAdapter needs to be on the UI thread (i tried that and got a nice exception and crash). When setadapter is called, the app locks up while data is being rendered in bindView() and newView(). Users have complained that it looks like the app is frozen (which effectively it is), so they munge around the menus and such while the operation is happening, causing more havoc. My current workaround involved doing a ViewSwitcher to put a little progress widget to switch out while the listview is being rendered. However, since it's on the UI thread, most if not all UI operations get slammed. Progress Dialogs don't show, the progress widget doesn't animate, animation transitions cache weirdly. The other workaround is to default to use smaller datasets which is the more "duh" solution. But the need will arise eventually to do huge dataset queries and/or render more complex views within a ListView...which I think will cause similar SetAdapter() blockages. My question is this. The API examples have the Inefficient list activity examples for binding "slow" data on scroll events. Is there a similar type of lazy loading/fetching of data for a corresponding cursor adapter? I want to basically have a listview bound with a Cursor adapter ONLY render the items in the visible view. It seems like the cursorView sort of does it already, but I was wondering if there was a way to tune the amount of records it prefetches on intial rendering after setadapter (). It seems to do way too much and it blocks the UI. Many thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---