Reputation: 57
What is the best way to load a list adapter. Simple question but I already know what most of you are going to say. You are going to say use the LoaderManager / CursorManager. Everyone is going to tell me how easy it is to use and that it doesn't do work on the UI thread (which I understand why that is important). Here is my issue. My app is fairly simple and I don't want to create a ContentProvider (which seems to be necessary with using the CursorManager). I am using a SQLLite database. What are some other methods that I can use to populate a ListAdapter? What are the PROS/CONS? Am I too believe that Android/Google wants all database connections to be made via a ContentProvider? If not what are some other acceptable ways of accessing data?
Upvotes: 1
Views: 77
Reputation: 38605
I would copy the source code of CursorLoader
and simply change how it does the query for the Cursor. Instead of getting a ContentResolver
and using a URI, have it query a SQLiteDatabase
that you supply (perhaps through the constructor). Then you can use this loader instead of the standard CursorLoader
.
I may take a stab at this, but in the meantime, here is the source for CursorLoader
.
Upvotes: 1