Search in sources :

Example 1 with Birthday

use of ezvcard.property.Birthday in project qksms by moezbhatti.

the class ContactOperations method convertBirthdays.

private void convertBirthdays(List<NonEmptyContentValues> contentValues, VCard vcard) {
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    for (Birthday birthday : vcard.getBirthdays()) {
        Date date = birthday.getDate();
        if (date == null) {
            continue;
        }
        NonEmptyContentValues cv = new NonEmptyContentValues(ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE);
        cv.put(ContactsContract.CommonDataKinds.Event.TYPE, ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY);
        cv.put(ContactsContract.CommonDataKinds.Event.START_DATE, df.format(date));
        contentValues.add(cv);
    }
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Birthday(ezvcard.property.Birthday) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

Birthday (ezvcard.property.Birthday)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1