Skip to content

Instantly share code, notes, and snippets.

@mattieapps
Created December 19, 2013 14:51
Show Gist options
  • Save mattieapps/8040278 to your computer and use it in GitHub Desktop.
Save mattieapps/8040278 to your computer and use it in GitHub Desktop.
A working way of making Android WebView go back one page on "back key" press
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment