में प्रत्येक संपर्क मेरी एंड्रॉयड आवेदन में के लिए जन्मदिन जाओ, मैं निम्नलिखित कोड के साथ सभी संपर्कों को बाहर पढ़ें:एंड्रॉयड आवेदन
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();
इस तरह मैं हर एक संपर्क के लिए जन्मदिन घटना को पढ़ने की कोशिश की है। लेकिन जाहिर है यह अभी तक काम नहीं करता है। तो मैं संपर्क की जन्म तिथि को सही तरीके से कैसे पढ़ सकता हूं?
धन्यवाद! आप इस प्रश्न को भी जोड़ सकते थे;) http://stackoverflow.com/questions/7376980/android-2-2-contact-birthday-date – caw