Nella mia applicazione Android, ho letto tutti i contatti con il seguente codice:Get compleanno per ogni contatto in applicazione Android
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
ContentResolver bd = getContentResolver();
String where = Data.RAW_CONTACT_ID+" = "+id+" and "+Data.MIMETYPE+" = "+CommonDataKinds.Event.CONTENT_ITEM_TYPE;
Cursor bdc = bd.query(ContactsContract.Data.CONTENT_URI, null, where, null, null);
if (bdc.getCount() > 0) {
while (bdc.moveToNext()) {
String birthday = bdc.getString(0);
Toast.makeText(getApplicationContext(), id+name+birthday, Toast.LENGTH_SHORT);
}
}
}
}
cur.close();
Ecco come ho provato a leggere l'evento di compleanno per ogni singolo contatto. Ma ovviamente non funziona ancora. Quindi, come posso leggere correttamente la data di nascita del contatto?
Grazie! Potresti anche aver collegato questa domanda;) http://stackoverflow.com/questions/7376980/android-2-2-contact-birthday-date – caw