谁能告诉我我该怎么做修改(编辑)和删除android日历事件这是用户自己使用我的 Android 应用程序添加的。我已经尝试了很多,但没有一个对我来说效果很好。我是第一次处理这些日历。我们有解决方案吗?
看看这个问题:堆栈溢出 https://stackoverflow.com/questions/20169149/android-calendar-specific-event-deletion
这段代码对我有用。
Uri eventsUri = Uri.parse("content://com.android.calendar/events");
ContentResolver cr = getContentResolver();
Cursor cursor;
cursor = cr.query(eventsUri, new String[]{ "_id" },"calendar_id=" + 1, null, null);
while(cursor.moveToNext()) {
long eventId = cursor.getLong(cursor.getColumnIndex("_id"));
cr.delete(ContentUris.withAppendedId(eventsUri, eventId), null, null);
}
cursor.close();
// Show message
Toast.makeText(getApplicationContext(), "Calendar Cleared!",Toast.LENGTH_LONG).show();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)