From 0adbb75efab07a92e3ebbb751af1b48469dd88cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 24 Jan 2016 21:07:31 +0100 Subject: [PATCH] Fix back button in HtmlActivity. It should return to the previous web page if any first, not directly to the dictionary. The action bar up button is for going directly back to the dictionary. --- src/com/hughes/android/dictionary/HtmlDisplayActivity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/com/hughes/android/dictionary/HtmlDisplayActivity.java b/src/com/hughes/android/dictionary/HtmlDisplayActivity.java index 2845c74..dd07c4e 100644 --- a/src/com/hughes/android/dictionary/HtmlDisplayActivity.java +++ b/src/com/hughes/android/dictionary/HtmlDisplayActivity.java @@ -109,6 +109,13 @@ public final class HtmlDisplayActivity extends ActionBarActivity { } } + @Override + public void onBackPressed() { + final MyWebView webView = (MyWebView)findViewById(R.id.webView); + if (webView.canGoBack()) webView.goBack(); + else super.onBackPressed(); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { // Explicitly handle the up button press so -- 2.43.0