Dro*_*Dev 10 events android calendar
任何人都可以告诉我如何修改(编辑)和删除用户自己使用我的Android应用程序添加的android日历事件.我已经尝试了很多,但没有一个对我很好.我是第一次处理这些日历.我们有解决方案吗?
小智 0
看看这个问题:StackOverflow
这段代码对我有用。
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();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4480 次 |
| 最近记录: |