ContentResolver cr = getContentResolver(); |
Uri uri = ContactsContract.Data.CONTENT_URI; |
String [] projection = new String[]{Event.DATA1}; |
String selection = Data.MIMETYPE+ "='" +Event.CONTENT_ITEM_TYPE+ "'" + " and " +Event.TYPE+ "='" +Event.TYPE_BIRTHDAY+ "'" ; |
Cursor cursor = cr.query(uri, projection, selection, null, null); |
List<Contacts> listcontacts = new ArrayList<Contacts>(); |
if (cursor!=null){ |
if (cursor.moveToFirst()){ |
do { |
Contacts contacts = new Contacts(); |
contacts.setBirthday(cursor.getString(0)); |
listcontacts.add(contacts); |
} while (cursor.moveToNext()); |
} |
} |
return listcontacts; |