Hi All,
I have a small app that queries records with birthday field and
displays them in a list.
I'm using 2.1 SDK so the code looks like this:
Cursor c = context.getContentResolver().query(Data.CONTENT_URI,
new String[] {
ContactsContract.RawContacts.CONTACT_ID,
ContactsContract.CommonDataKinds.Event.START_DATE,
ContactsContract.Contacts.DISPLAY_NAME
},
Data.MIMETYPE + "=? AND " +
ContactsContract.CommonDataKinds.Event.TYPE + "=?",
new String[] {Event.CONTENT_ITEM_TYPE,
Integer.toString(ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY)},
null);
if (c.moveToFirst()) {
final int dateColumn =
c.getColumnIndex(ContactsContract.CommonDataKinds.Event.START_DATE);
do {
final String date = c.getString(dateColumn);
// process the record
} while (c.moveToNext());
}
API documentation does not give any specific information about how the
date is stored in the database. It says "The event start date as the
user entered it".
On my HTC Hero format is either YYYY-MM-DD or --MM-DD if the year is
not set. I don't have other devices but Nexus One uses different
format for sure cause my application is reported not working on it and
on some other devices as well.
Is there any knowledge base about typical date formats on other
devices? Search does not give much regarding START_DATE field.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en