title: Pressing back button exits the app instead of navigating backwards in the WebView
body: <p>I am working on a WebView android app. I am unable to fix an issue in my app to back navigate. I am using this code and tried all modifications can be made to this.</p>
  <pre><code>public class DeviceActivity extends Activity {
      private WebView web;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main_layout);
  
          web = (WebView) findViewById(R.id.webView);
          web.getSettings().setJavaScriptEnabled(true);
          web.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
          web.getSettings().setPluginsEnabled(false);
          web.getSettings().setSupportMultipleWindows(false);
          web.getSettings().setSupportZoom(false);
          web.setVerticalScrollBarEnabled(false);
          web.setHorizontalScrollBarEnabled(false);
  
          // Our application's main page will be loaded
          web.loadUrl(&quot;file:///android_asset/fbp/index.html&quot;);
  
          web.setWebViewClient(new WebViewClient() {
              @Override
              public boolean shouldOverrideUrlLoading(WebView view, String url) {
                  return false;
              }
  
              public void onBackPressed() {
                  if (web.canGoBack()) {
                      web.goBack();
                  } else {
                      // My exit alert code goes here.
                  }
              }
          });
      }
  }
  </code></pre>
  <p>This doesn't navigate back but instead, it exits the app.
  Any help would be appreciated.</p>