Skip to content

Instantly share code, notes, and snippets.

@hndr91
Created October 3, 2015 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hndr91/5c021039066d83e9ce4d to your computer and use it in GitHub Desktop.
Save hndr91/5c021039066d83e9ce4d to your computer and use it in GitHub Desktop.
Simple Android WebView - onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()) {
//back to previous url
webView.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