Make back button work in CaptivePortalLogin app like a web browser.

Users will be using the app to navigate web pages like they are used to in
web browsers, so the back button should act similarly.  There also isn't
an in-app back button so this adds essentially necessary functionality.

bug:16397616
Change-Id: Idd73d4a048d79e56bf981a8f477336f00eaafc3b
This commit is contained in:
Paul Jensen
2014-07-18 12:27:23 -04:00
parent 53777b58f3
commit b6ea9ee6fe

View File

@@ -96,6 +96,16 @@ public class CaptivePortalLoginActivity extends Activity {
return true;
}
@Override
public void onBackPressed() {
WebView myWebView = (WebView) findViewById(R.id.webview);
if (myWebView.canGoBack()) {
myWebView.goBack();
} else {
super.onBackPressed();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();