Skip to content

Instantly share code, notes, and snippets.

@imammubin
Created November 21, 2019 02:43
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 imammubin/ddb5eb54dcc8d2e40077d2d4df4fb948 to your computer and use it in GitHub Desktop.
Save imammubin/ddb5eb54dcc8d2e40077d2d4df4fb948 to your computer and use it in GitHub Desktop.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
if(event.getAction()==KeyEvent.ACTION_DOWN){
switch (keyCode){
case KeyEvent.KEYCODE_BACK:
if(webView.canGoBack()){
webView.goBack();
}else{
finish();
}
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