From: Reimar Döffinger Date: Sun, 24 Jan 2016 20:07:31 +0000 (+0100) Subject: Fix back button in HtmlActivity. X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=commitdiff_plain;h=0adbb75efab07a92e3ebbb751af1b48469dd88cd 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. --- 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