Thursday, July 29, 2010

Re: [android-developers] Re: Accessing @hide methods in the Android source code

On Thu, Jul 29, 2010 at 3:35 AM, Kwisatz <rui.mtd.roque@gmail.com> wrote:
In comment 12 of that thread, a guy from Google itself suggests that
we must implement our own contacts editor. So, the easy and fastest
way of doing that is to replicate the Android Contacts application,
since it's open source and all. BUT, there are some calls to the
hidden methods in the SDK from the Contacts app. I want to replicate
them. Not use those methods to some other functionality. I think it's
acceptable somehow... no?

No this is not acceptable.  The contacts app shouldn't be using private APIs, but there are some things that we haven't had time yet to clean up.  In almost all cases where are private API is being used, however, there is actually an official public API that can be used instead.

Some background -- most of the app were written prior to 1.0, before we had @hide APIs and had gone through various API scrubs for the final SDK APIs.  At that point there wasn't time to go through all of the apps to change them to use the newly created public APIs, so they still make use of older private ones.  This continues to be cleaned up over time, but it isn't all done.

And a warning: these are some of the APIs most likely to break in the future, since once all of the apps have been cleaned up the old APIs can be removed.

The correct thing to do is build the code against the SDK, and fix any places using internal APIs to switch to the correct SDK API.

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