Last active
September 5, 2018 16:12
-
-
Save izmajlowiczl/6540078 to your computer and use it in GitHub Desktop.
[Android] WebView back button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Handles back button inside WebView. | |
// When user clicks back button and web history is not empty shows previous page from history. | |
mWebView.setOnKeyListener( new View.OnKeyListener() { | |
@Override | |
public boolean onKey( View v, int keyCode, KeyEvent event ) { | |
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) { | |
mWebView.goBack(); | |
return true; | |
} | |
return false; | |
} | |
}); |
It is not working, Please try to update.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is not working .