书签内容观察者
如何收到有关书签添加或删除的通知?
使用...
ContentResolver resolver = context.getContentResolver();
resolver.registerContentObserver(android.provider.Browser.BOOKMARKS_URI, **FALSE**, this);
...添加新书签时会调用 onChange() 回调,但删除预先存在的书签时不会调用 onChange() 回调。
否则使用...
ContentResolver resolver = launcher.getContentResolver();
resolver.registerContentObserver(android.provider.Browser.BOOKMARKS_URI, **TRUE**, this);
... onChange() 回调被连续调用...即使我只从一个网络导航到另一个网络。
我只想在书签表中添加或删除记录时收到通知。
谢谢指教 L。
how to be notified about bookmark add or remove?
Using...
ContentResolver resolver = context.getContentResolver();
resolver.registerContentObserver(android.provider.Browser.BOOKMARKS_URI, **FALSE**, this);
...the onChange() callback is called when a new bookmark is added but not when a preexistent bookmark is removed.
otherwise using...
ContentResolver resolver = launcher.getContentResolver();
resolver.registerContentObserver(android.provider.Browser.BOOKMARKS_URI, **TRUE**, this);
...the onChange() callback is called continuosly... even if i've only navigated from a web to another.
I'd like only to be notified when at the bookmark table a record is added or deleted.
Thanks in advice
L.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以找到书签数据库的计数并将其保存在文件、首选项或数据库中,当您发现更改时,您应该再次计算计数并与之前的进行比较。如果新计数较大,则表示增加,如果较少,则表示删除,如果相同,则表示发生了修改。
我希望这能明确您的方向或至少对您有所帮助。
你的
You can find the count of the bookmark db and save it in file, preference or database as you find change you should again calculate count and compare with previous. If new count is greater its mean addition and if less its mean deletion and if same means modification occurred.
I hope this will clear your direction or at least help you.
Yours