Pentium10
Pentium10

Reputation: 207830

How to add manually contacts group to Android database?

I want to define some Contact Groups.

I am wondering where and how does Android store the groups. Maybe in a Sqlite database?
If so, will be able to run a insert on it?

Otherwise how do you add new Contacts Group via the emulator?

Upvotes: 0

Views: 2107

Answers (2)

johnnie mac
johnnie mac

Reputation: 126

To add a contact group programmatically:

  ContentValues cv = new ContentValues();
  cv.put(ContactsContract.Groups.TITLE, groupName);
  cv.put(ContactsContract.Groups.GROUP_VISIBLE, 1);
  getContentResolver().insert(ContactsContract.Groups.CONTENT_URI, cv);

Upvotes: 0

Mark B
Mark B

Reputation: 200456

You definitely can't do an insert directly. You need to look into ContentProviders, Contacts.Groups and ContactsContract.

Upvotes: 1

Related Questions