Android History Content Observer

前端 未结 3 1465
轮回少年
轮回少年 2021-02-10 06:18

I implemented content observer of history but it is behaving weird.For every change in history its onChange() function runs 3-5 times.

static class BrowserOberse         


        
3条回答
  •  独厮守ぢ
    2021-02-10 07:03

    I think I may find the answer. First I want to say that my English is limited, I hope that you can understand me.

    Indeed, onChange(); runs several times for each change in history, at least two times.

    Because when user use the browser to browse a website, the system add a history in database, and onChange(); is called. But right now the system don't know the title of the url. After the system got the title of the url, the system updates the database and onChange(); is called second time.

    And, if the url is redirecting during the time, every time the system gets a new url, the system will update the database too, so onChange(); is called too. So, I think onChange will be called several times every change. Hope you can understand my English.

提交回复
热议问题