The standard reply is going to be you'll never actually need to view all 20K rows, so either page it out or filter the results to a more manageable number. Then again, if an end user is willing to scroll through 20K rows, they might be willing to wait 5s for it to load :)
Past that, I assume you're extending a CursorAdapter, you can use setEmptyView on the ListView to show a progress dialog, run your query on a background thread (or AsyncTask), then use a Handler (or the AsyncTask) to call changeCursor w/the results of the query. It will at least feel more responsive in that the UI doesn't just freeze while it's working. On Jan 31, 10:01 pm, THill <thill.dr...@gmail.com> wrote: > I need to be able to scroll through a list with (up to) 20K rows, > backed by a cursor on a read-only db. > > Testing 20K rows on a G1, the query takes approx .02s regardless of > table size, while binding the adapter to the list takes 4.5s. Note > that this is before the view calls used in rendering. > > What makes the binding delay more troublesome is that it blocks the UI > thread, and is incurred on every rotate. Combine these, and doing a > rotate just after starting the bind results in a delay up to 9s. > > I tried lazy loading with a base adapter, but that hits the same delay > in the underlying cursor.getCount(), and the overall user experience > isn't ideal. > > I also considered using an ArrayAdapter, adding synthesized objects > from the cursor rows, but then I'd incur the overhead of creating up > to 20K objects (not to mention the additional memory requirements). > > Any recommended alternatives or workarounds? > > Thanks in advance, > Tim -- 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