title: Preventing WebView reload on Rotate - Android Studio
body: <p>When I rotate my screen, the WebView reloads the whole page. So I disabled rotation in Android_Manifest.xml file, but it would be really cool if I could make rotation possible.</p>
  
  <p>SkateTube.java - </p>
  
  <pre><code>package com.example.skatetube.skatetube;
  
  import android.os.Bundle;
  import android.support.design.widget.FloatingActionButton;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.View;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.webkit.WebSettings;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  
  
  public class SkateTube extends AppCompatActivity {
      private WebView mWebView;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_skatetube);
  
  
          mWebView = (WebView) findViewById(R.id.activity_main_webview);
          WebSettings webSettings = mWebView.getSettings();
          webSettings.setJavaScriptEnabled(true);
          if (savedInstanceState == null)
          {
          mWebView.loadUrl("http://skatetube.sytes.net/");
          mWebView.setWebViewClient(new WebViewClient());
  
      }
  
  
  
      @Override
      public void onBackPressed() {
          if(mWebView.canGoBack()) {
              mWebView.goBack();
          } else {
              super.onBackPressed();
          }
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_skate_tube, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>Android_manifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.skatetube.skatetube"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
  
  
          &lt;activity
              android:name=".SkateTube"
              android:theme="@style/AppTheme.NoActionBar"
  
              android:configChanges="keyboard|keyboardHidden|orientation"
              android:label="State preserving implementation"/&gt;
  
  
  
      &lt;/application&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  
  &lt;/manifest&gt;
  </code></pre>