> Mark's comment about the object roster is what I was curious about. > SimpleCursorAdapter calls Cursor.moveToPosition() every time the list > calls bindView(), so I was wondering what the cursor does with result > set & when -- i.e., does it create objects (presumably indexes into > the db file) for the result rows up front, or only as requested?
A Cursor represents the entire result set. If you run a query for 20K rows and 5 columns, you will instantiate 100K objects at the time the query is actually run. A CursorAdapter will only convert rows into Views on demand. The ListView will only demand as many rows as can be seen on screen. So, for a query of 20K rows from a database with 5 columns, and a ListView capable of showing 10 rows, you will create 100K objects for the Cursor and a few dozen objects for the row Views. Hence, your cost is in doing the query, not in displaying the results. > Regardless, it looks like I'll be merging the results of multiple > cursors with some sort of Adapter wrapper, so I'll need to keep all of > those cursors active while the list is around. Possibly. You could use an ArrayList and ArrayAdapter for the actual ListView, and convert each query's Cursor into a new set of objects to be added to the adapter. Then, you can close and release the Cursor. This has the advantage of simplifying the merge logic, at the cost of extra processing (and briefly extra memory) when you load in each chunk. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html -- 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

