This is my code to view an event selected from a ListActivity (events
is the ArrayList containing all those events):
Uri viewUri = Uri.parse(\"c
While working with calendar events, I found out that the events table in the calendar.db stores information of normal events as you have used. (I guess you are using startTime for Dtstart and endTime as Dtend)
But in case of Recurrence events, Dtend will be null. So instead use lastDate column for the same since this column is never null. It will work well both in the case of recurrence events as well as for normal events.
But if you require more info on the recurrence events, use Instances table (like the exact start and end time for each of the occurrences) as suggested by @GeH.
beginTime and endTime can be 0/null because you got them from a wrong database, certainly from events database. You should use the instances database instead (ex: "content://com.android.calendar/instances/when/" on SDK 8).
In the instances DB, you'll get all "real" events : There, each recurring event has as many instances as needed, with correct begin and end timestamps; and the other events are visible too. You only have to read these fields - event_id, begin, end - and use them to open your Intent.
I think you may want to put a null
check before parsing:
long endTime = 0L;//use some default value
if( events.get(position).endTime != null)
endTime = Long.parseLong(events.get(position).endTime);
}
l_intent.putExtra("endTime", endTime );