开发者

Bookmarks content observer

how to be notified about bookmark add or remove?

Using...

ContentResolver resolver = context.getContentResolver();
re开发者_如何学JAVAsolver.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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜