What happens is that you app is performing both actions, making the webview go back AND calling super
, which will minimize your app.
That happens because both webviews can't be focused at the same time, therefore either if-else
statement will enter the else
case, and call super
.
This code may solve your problem:
public void onBackPressed() {
if (WV1.isFocused() && WV1.canGoBack()) {
WV1.goBack();
}
else if (WV2.isFocused() && WV2.canGoBack()) {
WV2.goBack();
}
else {
super.onBackPressed();
}
}