Strange webview goBack issue in android


I am using webview in Android. But strangely, sometimes even webview canGoBack method returns true, webview goBack method doesn’t work.

if (webView.canGoBack()) 

Thanks for any idea.


I finally managed to figure out how to do it

public void onFormResubmission(WebView view, Message dontResend, Message resend)

default behaviour of onFormResubmission is not to resubmit. resend.sendToTarget() changes that.

this will make your hardware back button work if you have made some code to handle the hardware button

public boolean onKeyDown(int keyCode, KeyEvent event) {
  if ((keyCode  KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
    return true;
  return super.onKeyDown(keyCode, event);

Answered By – ram

Leave a Comment