4

如何从android 日历StartTime中获取和获取事件?我正在使用此代码获取事件的所有数据,但它给了我,但我需要StartEnd。这是代码EndTimeStartDateEndDateDate + Time

CalNames[i] = "Event" + cursor_event.getInt(0) + ": \nTitle: "
                        + cursor_event.getString(1) + "\nDescription: "
                        + cursor_event.getString(2) + "\nStart Date: "
                        + new Date(cursor_event.getLong(3)) + "\nEnd Date : "
                        + new Date(cursor_event.getLong(4)) + "\nLocation : "
                        + cursor_event.getString(5);
4

1 回答 1

1

用于cursor_event.getLong(cursor_event.getColumnIndex("dtstart"))获取自纪元以来事件以 UTC 毫秒开始的时间。

获取事件结束时间使用cursor_event.getLong(cursor_event.getColumnIndex("dtend"))

您可以在此处找到所有事件列http://developer.android.com/reference/android/provider/CalendarContract.EventsColumns.html#DTEND

于 2012-11-04T22:05:55.817 回答