小编rud*_*der的帖子

删除所有本地日历事件有效,但会触发太多事件已删除的错误

我使用以下方法在本地删除谷歌日历上的所有事件(ICS和JB):

public void deleteAll(){
    String selection = "(" + CalendarContract.Events.CALENDAR_ID + " = ?)";
    String[] selectionArgs = new String[] { Integer.toString(this.calId) };
    ContentResolver cr = context.getContentResolver();
    int rows = cr.delete(CalendarContract.Events.CONTENT_URI, selection, selectionArgs);
    Log.d(TAG, rows + " events deleted");
}
Run Code Online (Sandbox Code Playgroud)

一切正常,但我收到一个恼人的警告:删除太多日历

Delete limit exceeded

 There are 21 deleted items for Calendar, account
 xxxxx.xxxxx@gmail.com.  What would you like to do?" 

Delete the items. 
Undo the deletes.  
Do nothing for now.
Run Code Online (Sandbox Code Playgroud)

错误显示的原因是什么,有没有人知道避免错误的方法?我正在使用HTC One-X

关心R.

android calendar

5
推荐指数
1
解决办法
1719
查看次数

标签 统计

android ×1

calendar ×1