我正在尝试弄清楚如何在我的Android应用中添加提醒到日历事件。下面用红色圈出的图像是我想以编程方式添加到图像下方的代码中的图像。这就是我遇到的困难。我很感激你的帮助!
这就是我到目前为止......除了我需要帮助之外,一切正常。
public void addEventToCalendar(String EventTitle, String EventDescription, String EventLocation, int EventStartDateYear, int EventStartDateMonth, int EventStartDateDay, int EventEndDateYear, int EventEndDateMonth, int EventEndDateDay, int BeginHour, int BeginMin, int EndHour, int EndMin, Boolean AllDay, String EventFrequency) {
Toast.makeText(this, "Adding Event To Your Calendar...", Toast.LENGTH_SHORT).show();
ContentValues event = new ContentValues();
Calendar startcalendar = Calendar.getInstance();
Calendar endcalendar = Calendar.getInstance();
startcalendar.set(EventStartDateYear, EventStartDateMonth, EventStartDateDay, BeginHour, BeginMin);
endcalendar.set(EventStartDateYear, EventEndDateMonth, EventEndDateDay, EndHour, EndMin);
event.put(CalendarContract.Events.CALENDAR_ID, 1);
event.put(CalendarContract.Events.TITLE, EventTitle);
event.put(CalendarContract.Events.DESCRIPTION, EventDescription);
event.put(CalendarContract.Events.EVENT_LOCATION, EventLocation);
event.put(CalendarContract.Events.DTSTART, startcalendar.getTimeInMillis());
event.put(CalendarContract.Events.DTEND, endcalendar.getTimeInMillis());
event.put(CalendarContract.Events.ALL_DAY, AllDay);
event.put(CalendarContract.Reminders.MINUTES, 5); //this here is what I am trying to figure out... 5 minutes before event or 5 hours before event, or 5 days before event, etc.
event.put(CalendarContract.Events.HAS_ALARM, true);
event.put(CalendarContract.Events.RRULE, EventFrequency);
event.put(CalendarContract.Events.EVENT_TIMEZONE, "GMT-05:00");
if (android.os.Build.VERSION.SDK_INT <= 7) {
eventsUri = Uri.parse("content://calendar/events");
} else {
eventsUri = Uri.parse("content://com.android.calendar/events");
}
Uri url = getContentResolver().insert(eventsUri, event);
Toast.makeText(this, "Event Added To Your Calendar!", Toast.LENGTH_SHORT).show();
}
}
答案 0 :(得分:0)
您需要在CalendarContract.Reminders中插入一个条目,例如
s=df1.merge(df2,on = 'ID', how = 'inner')
t=s.groupby(np.array(s.columns.str.split('_').str[0]),axis=1).diff().dropna(axis=1).add_suffix('DIFF')
pd.concat([s,t],axis=1).sort_index(axis=1)
Out[896]:
ID X_x X_y X_yDIFF Y_x Y_y Y_yDIFF Z_x Z_y Z_yDIFF
0 1 10 5 -5.0 20 10 -10.0 30 15 -15.0
1 5 40 55 15.0 50 12 -38.0 60 22 -38.0