Hi,

I got problems dealing with Calendar Provider. If I try to i.e. get number
of events at given day, the value I receive is incorrect. I do that this
way:

Calendar car = Calendar.getInstance();
Uri.Builder builder = Uri.parse("content://" + getCalendarAuthority() +
"/instances/when/").buildUpon();

cal.set(Calendar.HOUR, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
ContentUris.appendId(builder, cal.getTimeInMillis() );

cal.set(Calendar.HOUR, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
ContentUris.appendId(builder, cal.getTimeInMillis() );

Cursor eventCursor = getContentResolver().query(builder.build(), new
String[] { "event_id", "title"}, "selected=1", null, null);

count returned by eventCursor.getCount() does not match events I got in
calendar. I suspect the problem is in the way I construct date
constrains, as if I query Calendar for startDay the value returned is
different (shorter) than millis. How to build that query so it correctly
work no matter of timezone?


Second thing - I tried to use "/instances/groupbyday" to count evens on
given day, but I failed to make it working at all. How it shall be invoked
to work?


Any hints apprecaited
TK

-- 
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

Reply via email to