views:

141

answers:

1

Hi,

I have an android application that loads web pages in an activity with a WebView. I am using the retrieving the page manually and using WebView's loadDataWithBaseURL to display it on screen. Everything there is fine.

Now, i am trying to override the Back button press to simulate going back in the WebView history stack. I am able to override the Back button press, i can see that there is a history stack in the WebView, i can see that the history url is correct, but when i call WebView's goBack() method, it displays a blank page.

Anyone encountered this before or give me a couple of suggestions to proceed from this?

Edit: If i use WebView's loadUrl method, the Back button with an override works as intended. But why.... If i need to handle this manually, how do i start messing with history pages?

A: 

You should check if the canGoBack() method returns true before calling goBack()

Arman
I am already checking it. From my description in the question above, i am also able to get what the history url is (the page before). When i execute goBack, it shows a blank page.
Bundee