I have an Android web view that I want it to go back with the Android button. I work if the previous site, for example, https://www.aaa.com/index.php
and https://www.aaa.com/index2.php
, but canGoBack () returns false when the URLs, for example, https://www.aaa.com/index.php?page=page1
and https://www.aaa.com/index.php?page=page2
. I think this is probably because the URLs are the same, they are just variables at the end that change. This is my code:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if (view.canGoBack()) {
view.goBack();
} else {
finish();
}
return true;
}
}
return super.onKeyDown(keyCode, event);
}
How can I make it return even if the variable has changed to a URL?
source
share