I have set up the model part of my application similar to the
MicroJobsDatabase file in the MicroJobs sample application.  As I like
how slick the structure is, I wanted to have all of my data in this
file, including data queried from content providers.

The way the MicroJobsDatabase class works is that it has several
cursor factories that are returned to an Activity that needs the
data.  This works great because the MicroJobsDatabase class extends
the SQLiteOpenHelper class.

What I would like to do is create content provider cursors in this
class in a similar fashion.  The caveat seems to be that content
resolvers and managed queries need to be called from an Activity
subclass.  So what is the common wisdom here?  Query the content
provider data in a separate Activity subclass and call it as a
startActivtyForResult and deal with it that way?  Or is there a way to
query a content provider from a class that does not extend Activity?

An example usage would be if I wanted to query the Contacts content
provider to give my app an arraylist of current contacts and then let
the user store "user groups" of those contacts in the SQLite
database.  In which case, the calling Activity would just request the
Contacts cursor created in the model class and then use it as the list
adapter.

All of this works fine if I call the content providers from an
Activity, but I would really lie to do that from my model class and
create a cursor factory for each content provider I query.

Any help would be greatly appreciated because I am kinda stumped here.

-- 
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

Reply via email to