On 19 July 2011 11:33, Filip Havlicek <[email protected]> wrote:
> Hi everyone,
>
> I'm facing a bit of a problem now and would like to hear your
> opinions/advices/thoughts. I'm developing a small Android application and a
> part of it needs to watch the current URL user has navigated to in the stock
> browser (com.google.android.Browser).
>
> Since the stock browser is supposed to use the Browser content provider
> http://developer.android.com/reference/android/provider/Browser.html to
> store bookmarks and history, I thought I will just register a
> ContentObserver on the Browser.BOOKMARKS_URI and listen for changes. It
> works fine as long as the user is browsing forward (= clicking on links etc)
> or typing the address manually, the onChange method of the ContentObserver
> is always called and by filtering the results of a query on the
> Browser.BOOKMARKS_URI I'm able to tell the current website being read.
>
> The problem occurs when the user presses the back button on the phone. The
> stock browser reacts correctly by loading the previous site and the onChange
> method of the registered ContentObserver is also fired, but the contents of
> the data query is the same as it was before the back button press. The
> sample code is here http://pastebin.com/YfjZeQUS and a sample Eclipse
> project is attached. Am I doing something wrong or is the history database
> not being updated properly? I would expect the DATE or VISITS database
> fields to change when the back button is pressed.
>
> Thank you all for your replies.
>
> Best regards,
> Filip Havlicek


Back and Forward buttons should not alter the history, but traverse it.
The same behaviour exists in desktop browsers.

Daniel

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to