0

我是 android 新手,我正在获取 android 联系人。

现在我正在使用语句

// Deaclaring desired fileds
        final String[] projection = new String[] { RawContacts.ACCOUNT_NAME,
                RawContacts._ID, RawContacts.DELETED };

        // Derclaring desired cursor

        final Cursor rawContacts = managedQuery(RawContacts.CONTENT_URI, projection. null, null, null); 

所以它表明managedQuery在 android api 11 中已被弃用。所以它是否可以在 android api 级别 11 上工作而不是。

或者

如果我使用最新版本,它是否适用于旧的 api 版本

4

2 回答 2

0

您的代码看起来几乎与 ContactManager for Android v4.2.2 (API 17) 中的示例代码相同,它与 v2.2 (API 10) 相同,并且可以追溯到 v2.1 (API 7) 中的第一个示例代码包)。所以,是的,这肯定会在更旧的版本中工作。考虑到他们仍然在 Samples 包中包含调用它的方法,不推荐使用的方法也应该有很长的保质期。

于 2013-03-18T13:36:55.963 回答
0

它将适用于 API 11。

关于旧版本,在编写代码时,如果代码无法在清单中建立的 Android API 版本中运行,您将收到错误/警告提示。

于 2013-03-18T13:42:19.750 回答