开发者

Set contact group display option programmatically

I'm trying to set the display option of a account to visible programmatically b开发者_开发技巧ut having no luck so far. At the moment I'm having to go into my contacts, selecting options, clicking on display options and then manually making them visible.

No doubt if i release my app like this i will get many complaints about contacts not showing up etc...

Any help would be much apreciated, thank you! :)


You got two ways of doing it. One by creating a entry in Groups table and another in Settings. Can you try below and check?.

        cv.put(ContactsContract.Settings.ACCOUNT_NAME, accountName);
        cv.put(ContactsContract.Settings.ACCOUNT_TYPE, accountYype);
        cv.put(ContactsContract.Settings.UNGROUPED_VISIBLE, 1);
        getContentResolver().insert(ContactsContract.Settings.CONTENT_URI, cv);


You need to create a entry into group table(Groups.CONTENT_URI) with your account name and set visibility ( Groups.GROUP_VISIBLE) to true (1).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜