【问题标题】:How to open contact showing the "Group" tab using Intent?如何使用 Intent 打开显示“组”选项卡的联系人?
【发布时间】:2012-12-28 13:57:18
【问题描述】:

我想从我自己的 Android 应用中打开联系人。

如果我这样做:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(ContactsContract.Contacts.CONTENT_URI);

我可以打开联系人,显示人物标签。我怎样才能实现类似的目标,但改为显示 Group 选项卡?更改为 ContactsContract.Contacts.CONTENT_GROUP_URIContactsContract.Groups.CONTENT_URI 不起作用。单击后,它将在控制台中弹出“无法完成操作”和以下消息:

01-14 17:21:36.525: W/ContentResolver(26851): Failed to get type for:
  content://com.android.contacts/contacts/group/0 (
    URI: content://com.android.contacts/contacts/group/0,
    calling user: android.uid.system:1000,
    calling package is one of: [
      com.motorola.usbcamera,
      com.motorola.android.deepsleepservice,
      com.android.keychain,
      com.motorola.blur.setup,
      com.android.settings,
      com.motorola.atcmd,
      com.android.portal,
      com.android.vpndialogs,
      com.motorola.meter.omap,
      com.motorola.dockcomm,
      com.motorola.blur.setupsettings,
      com.android.providers.settings,
      com.motorola.Upgrader,
      com.motorola.devicestatistics,
      com.motorola.android.eapauthservice,
      com.motorola.android.fota,
      android,
      com.motorola.android.providers.settings,
      com.motorola.atcmdlauncher,
      com.google.android.backup,
      com.motorola.globalunplug,
      com.motorola.android.encryption.settings,
      com.motorola.blur.provider.datacollector,
      com.motorola.datacollection,
      com.motorola.dataswitch,
      com.android.systemui,
      com.motorola.contextual.fw,
      com.motorola.vpn,
      com.motorola.android.extdispservice,
      com.motorola.android.dlnasystemservice
    ]
  )

编辑 或者是否可以在开始与“人员”选项卡联系后以编程方式切换到“组”选项卡?

任何建议将不胜感激。

【问题讨论】:

  • 你试过 ContactsContract.Groups.CONTENT_URI 吗?
  • ContactsContract.Groups.CONTENT_URI 也不起作用。

标签: android android-intent uri android-contacts contactgroups


【解决方案1】:

如果你还没有尝试过,你应该试试这个:

ContactsContract.Groups.CONTENT_URI

这是组表的 URI。

编辑:

这里是官方链接供参考:http://developer.android.com/reference/android/provider/ContactsContract.Groups.html#CONTENT_URI

很抱歉,但这似乎是不可能的。

https://stackoverflow.com/questions/9734319/android-contactscontract-groups-activity-ui

Accessing Android Contact Group Names

目前看来,Groups.CONTENT_URI 仅用于获取组数据,而不是打开活动。

【讨论】:

  • 您好,感谢您的帮助。但是我已经尝试过了,但没有成功。
  • @LeonQiao 是的,Leon,经过一些研究和一些代码的尝试,现在看来确实不可能。
  • 谢谢伙计。在这种情况下,是否可以在打开显示“人员”选项卡的联系人后以编程方式切换到“组”选项卡? @eestein
  • @LeonQiao 昨天我尝试了一些代码但没有成功。我今天会看看,看看这是否可能。我会让你知道结果。
  • @LeonQiao 嗨,我已经尝试了一些东西,从寻找附加功能到尝试获取当前正在运行的应用程序并对其进行修改,但没有成功。对不起,但我认为这是不可能的,即使有解决方法也是如此。我想你必须等待谷歌通过 new Intent() 来允许它。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多