仅在 Eclair 及更高版本上显示带有 Android 手机联系人选择列表的本机活动?

发布于 2024-09-04 00:30:00 字数 576 浏览 0 评论 0原文

我想向用户显示所有联系人电话号码的扁平化选择列表,并且它必须从 1.6 版本开始工作。我已阅读有关 SO 的相关问题以及 Eclair 的 Android 文档。

问题是,即使将我的代码拆分为工厂类和特定实现对我来说也不起作用,因为使用 Contacts.CONTENT_URI 仅显示联系人而不是单个号码。我需要的是 1.6 版本的这个

Intent intent = new Intent(Intent.ACTION_PICK, Phones.CONTENT_URI);
startActivityForResult(intent, REQUEST_PICK_CONTACT);

以及 2.0 及更高版本的等效版本。

即使我让他们的示例正常工作,通过针对 2.1 API 进行构建,我是否不会阻止我的应用程序在市场上对使用早期版本操作系统的用户可见?例如,我无法针对 1.6 模拟器启动它。

I want to show the user a flattened pick list of all their contacts phone numbers and it must work from versions 1.6 up. I have read the related questions on SO and the Android documentation for Eclair.

The problem is, even splitting my code into a factory class and specific implementations does not work for me because using Contacts.CONTENT_URI only shows contacts not individual numbers. What I need is this for version 1.6

Intent intent = new Intent(Intent.ACTION_PICK, Phones.CONTENT_URI);
startActivityForResult(intent, REQUEST_PICK_CONTACT);

And the equivalent for 2.0 and above.

Even if I get their example to work, by building against the 2.1 API am I not stopping my app being visible on the Market to users with earlier versions of the OS? I can't launch it against a 1.6 emulator, for example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青瓷清茶倾城歌 2024-09-11 00:30:00

根据文档联系人类已被折旧,您必须使用 < strong>ContactsContract 类来读取联系人。
一个完美的例子可以在如何在 Android 2.0 上读取联系人

As per the Documentation contacts class has been depreciated, instead of that you have to use ContactsContract class to read the contacts.
A perfect example is found at How to read contacts on Android 2.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文