Your back button closes the activity because that’s the normal behaviour. What you need to do if you want to use the back button to act as a Go back button for your WebView is:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
yourWebView.goBack();
return true;
}
return super.onKeyDown(keyCode, event);
}
For further questions, please try to use the auto-complete feature, not only shows the methods / values you can use but also displays the corresponding JavaDoc to learn how to use them.
solved is there a goback() for webview? [closed]