Wednesday, October 21, 2009

[android-developers] Re: Question about built-in content providers

Yes, the definitions in android.provider are in the SDK, so must be supported. I guess you could use them to build things that are invalid my mixing columns from one URI with another URI, that may happen to work, but if you follow the straight-forward definitions there you are using the SDK and thus supported APIs.

On Wed, Oct 21, 2009 at 5:53 AM, tauntz <tauntz@gmail.com> wrote:

In 1.5 and 1.6 the following code snippet works:
---
import android.provider.Contacts;
import android.provider.Contacts.People;

ContentValues values = new ContentValues();
values.put(Contacts.ExtensionsColumns.NAME, "name");
values.put(Contacts.ExtensionsColumns.VALUE, "value");
Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, 1);
Uri personExtensionUri = Uri.withAppendedPath(personUri,
People.Extensions.CONTENT_DIRECTORY);
getContentResolver().insert(personExtensionUri, values);
---

Can we rely on the fact that the same URIs will be handled by the
built-in content providers also in future versions/devices or is there
a possibility that some of them do not support it by throwing a
UnsupportedOperationException ( Unknown uri: ... )? The documentation
for content providers says that: "Android ships with a number of
content providers for common data types (audio, video, images,
personal contact information, and so on). You can see some of them
listed in the android.provider package." Does that mean that
everything that is under android.provider.* has to be supported by all
future Android versions/devices?


Tauno





--
Dianne Hackborn
Android framework engineer
hackbod@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.


--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments:

Post a Comment