[Moderator, please try to shorten your "lag". I am trying to post this
message since 20th Feb]

Hi,

I got problems dealing with Calendar Provider. If I try to count  number of
events at given day, the value I get is incorrect. This is my code:

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 problem - I tried to use "/instances/groupbyday" to count evens on
given day as this shall simply be faster, but I failed to make it working at
all. How it shall be invoked to work? Is my problem (again) date isssue
related?


Is there any smart way to be notified when calendar database changed? Is
Observer working?


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