查询Android的Google日历检索甚至删除事件 [英] Querying android calendar retrieves even deleted events

查看:273
本文介绍了查询Android的Google日历检索甚至删除事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面提到code检索保存在Android的原生日历应用程序的所有日历的所有事件。现在,如果我从本地日历中删除某个事件,还是我的code取出并表明事件。这怎么可能。它设置一些删除标志,而不是实际删除该事件。

 光标光标= cr.query(Uri.parse(内容://com.android.calendar/events),
                    投影,选择,selectionArgs两个,NULL);


解决方案

请检查是否在已删除标志设置。

或者你也可以尝试,包括选择以下

 键,(删除!= 1)

所以选择字符串变,

 字符串选择=((+头衔+LIKE'+名字+')AND(删除= 1)!);

偶尔,CalendarDB有时花费要删除的事件。但是,删除列将被标记为1,表明他们将尽快删除。究其原因,可能延迟日历正在等待同步

PS:尝试使用这个工具 - http://www.cellobject.net/Tools/ CellObjectSQLiteXMLBrowser.aspx ,以可视化的日历数据库。请在db检查已删除和脏列

I am using below mentioned code to retrieve all the events from all the calendars saved in the android's native calendar application. Now if I delete certain event from the native calendar, still my code fetches and shows that event. How can this be possible. Does it set some delete flag instead of actually deleting the event.

Cursor cursor = cr.query(Uri.parse("content://com.android.calendar/events"),
                    projection, selection, selectionArgs, null);

解决方案

Please check whether the 'DELETED' flag is set.

or you can also try including the following in SELECTION

AND (deleted != 1)

so the selection string becomes,

String selection = "( ("+ "title" + " LIKE '"+name+"') AND ( deleted != 1 ) )";

Occasionally, the CalendarDB takes sometime for the events to be removed. But the 'deleted' COLUMN will be marked as '1' indicating that they will be deleted soon. The reason for the delay maybe the calendar is waiting to be synced

p.s: Try using this tool -- http://www.cellobject.net/Tools/CellObjectSQLiteXMLBrowser.aspx to visualize the Calendar DB. Please check for the 'deleted' and 'dirty' columns in the db

这篇关于查询Android的Google日历检索甚至删除事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆