2

I want to open Contact from my own Android app.

If I do :

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

I can open contact, showing the People tab. How can I achieve a similar goal but showing the Group tab instead? Changing to ContactsContract.Contacts.CONTENT_GROUP_URI or ContactsContract.Groups.CONTENT_URI does not work. Once clicked, it would give a popup "Could not complete operation" and the following message in the console:

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

EDIT Or is it possible to programmatically switch to "Group" tab after starting contact with "People" Tab ?

Any suggestions would be greatly appreciated.

Leon Qiao
  • 31
  • 5

1 Answers1

1

If you haven't tried yet, you should try this:

ContactsContract.Groups.CONTENT_URI

This is the URI for the groups table.

EDIT:

Here's the official link for reference: http://developer.android.com/reference/android/provider/ContactsContract.Groups.html#CONTENT_URI

I'm sorry, but it does seem it's not possible.

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

Accessing Android Contact Group Names

It looks like for now, Groups.CONTENT_URI is only for fetching group data, not opening the activity.

Community
  • 1
  • 1
eestein
  • 4,914
  • 8
  • 54
  • 93
  • Hi, Thanks for the help. But I have already tried this and it did not work. – Leon Qiao Jan 14 '13 at 15:50
  • @LeonQiao yes Leon, after some research and some codes tried it does seem it's not possible for now. – eestein Jan 14 '13 at 16:40
  • Thanks man. In that case, is it possible to programmatically switch to "Group" tab after opening contact showing "People" tab ? @eestein – Leon Qiao Jan 15 '13 at 08:32
  • @LeonQiao Yesterday I tried some codes without success. I'll give a look today and see if that's possible. I'll let you know the results. – eestein Jan 15 '13 at 11:03
  • @LeonQiao Hi, I've tried some stuff, from looking for extras to trying to get the current running app and modify it, but with no success. I'm sorry, but I don't think it's possible, not even with a workaround. I guess you'd have to wait for Google to allow this through new Intent(). – eestein Jan 15 '13 at 16:58
  • Yeah. I also tried but nothing worked out for me. But thank you for the help :D @eestein – Leon Qiao Jan 16 '13 at 07:58
  • http://manishkpr.webheavens.com/android-programmatically-create-group-contact-with-image-photo-example/ I know its not exactly what you want but I am searching too – Pomagranite Sep 04 '17 at 22:49