[android-developers] getting exception when inserting events in android calendar.

2010-08-09 Thread kamiomar
 i am inserting  all day recurrence event in  the android calendar.
the code is following:



ContentValues event = new ContentValues();
event.put(calendar_id, calId);
event.put(title, Event Title);
event.put(description, Event Desc);
event.put(eventLocation, Event Location);
event.put(allDay, 1);
event.put(eventStatus, 1);
event.put(visibility, 0);
event.put(transparency, 0);
event.put(hasAlarm, 1);

Date d = new Date();
d.setHours(8);
d.setMinutes(30);
d.setSeconds(30);
long startTime = d.getTime();
d.setHours(12);
d.setMinutes(30);
d.setSeconds(20);
long endTime = d.getTime();
event.put(dtstart, startTime);
// event.put(dtend, endTime);
event.put(rrule, FREQ=DAILY;WKST=SU);
// event.put(lastDate, endTime);
// event.put(timezone, Asia/Karachi);
//event.put(duration, P3600S);

//Calendar gmtC = new GregorianCalendar(TimeZone.getTimeZone(Asia/
Karachi));



// event.put(transparency, 0);
// event.put(hasAlarm, 1); // 0 for false, 1 for true
Uri eventsUri = Uri.parse(content://calendar/events);
Uri url = getContentResolver().insert(eventsUri, event);



i am getting the following exception:

java.lang.IllegalArgumentException: allDay is true but sec, min, hour
are not 0.

need help!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] getting exception when inserting events in android calendar.

2010-08-09 Thread TreKing
On Mon, Aug 9, 2010 at 8:23 AM, kamiomar kamio...@gmail.com wrote:

 i am getting the following exception:

 java.lang.IllegalArgumentException: allDay is true but sec, min, hour are
 not 0.

 need help!


a) Are you serious? Did you actually read the message? I don't think a
clearer, or more explicit exception message has ever been reported in the
history of Java.

b) At some point someone will come along and tell you that the Calendar is
not a public API and what you're doing is asking for trouble.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en