Hunk of Hulk wrote:
> In the notepad example and others, the content provider never even
> declares its CONTENT_URI anywhere inside itself, yet the docs say to
> publicly declare this. 

That's really only helpful if the ContentProvider will be used by
something else in the same process, and it is never strictly necessary.

 It's declared in a different class.  So when
> an activity queries a content provider with a CONTENT_URI, how does
> Android know which one I want.  I see no link between a content
> provider and its CONTENT_URI declared in another class.

Look at the <provider> element in the manifest.

> I also don't how to think about intents and content providers.  I know
> that you don't call an intent on a content provider.  But an activity
> queries a content provider without an intent, and an activity has a
> mimetype attribute in the manifest that would seem to tie it to a
> content provider.

Each ContentProvider declares, for a given Uri, what the MIME type is.
This allows an activity, with only a Uri, to ask Android "hey, please
start an activity that can view one of these...ummmm...things". The
activity creates an Intent with that Uri. Android uses the
ContentProvider to figure out the MIME type for that Uri. Android then
finds an activity that supports the desired action (e.g., ACTION_VIEW)
on that MIME type.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.0
Available!

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