title: Android - WebView back button
body: <p>I have a mirroring of a website in WebView and I would like that when I press the ** Back ** button on the Smartphone, I would go back to the previous page. Currently if I press the ** Back ** button on the Smartphone, the application is minimized (It stays in the background).
  I do not know how to do this, can anyone help me?</p>
  
  <p><strong>MainActivity</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.webkit.WebSettings;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          WebView wv = (WebView) findViewById(R.id.webview1);
          wv.loadUrl("https://www.xxxx.com.br");
          wv.setWebViewClient(new WebViewClient());
  
          WebSettings ws = wv.getSettings();
          ws.setJavaScriptEnabled(true);
          ws.setSupportZoom(false);</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Manifest</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@drawable/ic_stat_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
  
          &lt;activity android:name=".MainActivity"&gt;
  
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
  
  
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;</code></pre>
  </div>
  </div>
  </p>