I have an AppWidget which provides a summary of some data stored and
controlled by my main Application.

(In a similar way to a Calendar AppWidget showing the next event from
the main Calendar application).

I want to know the best practice for retrieving the data to update my
widget.

I have followed the example, and I have extended AppWidgetProvider and
have a working widget, onto which I can update.

I would expect to read the data from my main application and then
update it via my AppWidgetProvider's onUpdate() routine.

Now, is the best practice here for my separate main application to
provide the data via a ContentProvider? I assume so, as my Appwidget
is not part of the same application.

Is it possible to access a ContentProvider inside my onUpdate()
routine?

Before writing my main application content provider I started to test
out retrieving some available data like Contacts information, and
showing say a contact name in my widget, to show I can extract data
from an existing ContentProvider.

When accessing the Contacts contentprovider, the examples talk
about:

1) Activity.managedQuery(), but my AppWidget is not an activity.
2) ContentResolver.query(), but I can't work out how to get a valid
ContentResolver so I can access the Contacts.

getContentResolver() does not appear to be defined for
AppWidgetProviders.

Am I approaching this the correct way?

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

Reply via email to