【问题标题】:Update and delete calendar events in android through my application通过我的应用程序更新和删除 android 中的日历事件
【发布时间】:2013-02-19 19:30:54
【问题描述】:

谁能告诉我如何修改(编辑)和删除用户自己使用我的 android 应用程序添加的 android 日历事件。我已经尝试了很多,但没有一个适合我。我是第一次处理这些日历。我们有解决方案吗?

【问题讨论】:

    标签: android events calendar


    【解决方案1】:

    看看这个问题: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();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-04
      • 1970-01-01
      • 1970-01-01
      • 2023-01-09
      • 2012-03-12
      相关资源
      最近更新 更多