Skip to content

Instantly share code, notes, and snippets.

@TheRyanMiller
Created May 17, 2016 03:42
Show Gist options
  • Save TheRyanMiller/bb4bb21cf596af00d57273611330a1d7 to your computer and use it in GitHub Desktop.
Save TheRyanMiller/bb4bb21cf596af00d57273611330a1d7 to your computer and use it in GitHub Desktop.
// method to get name, contact id, and birthday
private Cursor getContactsBirthdays() {
Uri uri = ContactsContract.Data.CONTENT_URI;
String[] projection = new String[] {
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Event.CONTACT_ID,
ContactsContract.CommonDataKinds.Event.START_DATE
};
String where =
ContactsContract.Data.MIMETYPE + "= ? AND " +
ContactsContract.CommonDataKinds.Event.TYPE + "=" +
ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY;
String[] selectionArgs = new String[] {
ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE
};
String sortOrder = null;
return managedQuery(uri, projection, where, selectionArgs, sortOrder);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment