title: How to prevent reload of Webview page
body: <p>I have created an app in which i have 3 tabs to display webpages using fragment. Every time i switch to tab 2 from tab 1 and then back to tab 1, tab 1 reloads. I have searched google and solutions which i found didn't work. So far i have tried this:</p>
  
  <pre><code> @Override
  public void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  mWebView.saveState(outState);
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
  super.onActivityCreated(savedInstanceState);
  mWebView.restoreState(savedInstanceState); 
  }
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code> &lt;activity ...
        android:launchMode="singleInstance"
      android:alwaysRetainTaskState="true"&gt;
  </code></pre>
  
  <p>Here is my Main Activity</p>
  
  <pre><code>import android.annotation.TargetApi;
  import android.os.Build;
  import android.os.Bundle;
  import android.support.v4.view.ViewPager;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  
  import com.tech.slidechat.adaptor.SlidingTabLayout;
  import com.tech.slidechat.adaptor.TabsPagerAdapter;
  
   @TargetApi(Build.VERSION_CODES.HONEYCOMB)
   public class MainActivity extends ActionBarActivity {
   SlidingTabLayout tabs;
   ViewPager viewPager;
   TabsPagerAdapter adapter;
  
   Toolbar toolbar;
  
  CharSequence Titles[]={ "tab1", "tab2", "tab3" };
  int Numboftabs =3;
  
  @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
       toolbar = (Toolbar) findViewById(R.id.tool_bar);
      setSupportActionBar(toolbar);
  
      adapter = new TabsPagerAdapter(getSupportFragmentManager(), Titles, Numboftabs);
      // Assigning ViewPager View and setting the adapter
      viewPager = (ViewPager) findViewById(R.id.pager);
      viewPager.setAdapter(adapter);
      // Assiging the Sliding Tab Layout View
      tabs = (SlidingTabLayout) findViewById(R.id.tabs);
      tabs.setDistributeEvenly(true);
      tabs.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() {
          @Override
          public int getIndicatorColor(int position) {
              return getResources().getColor(R.color.tabsScrollColor);
          }
  
          @Override
          public int getDividerColor(int i) {
              return 0;
          }
      });
  
      tabs.setViewPager(viewPager);
  }
  @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_main, 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>And this is one of my Webview Fragments:</p>
  
  <pre><code>  import android.os.Bundle;
    import android.support.v4.app.Fragment;
    import android.view.KeyEvent;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.webkit.WebChromeClient;
    import android.webkit.WebView;
    import android.webkit.WebViewClient;
    import android.widget.ProgressBar;
  
    public class GamesFragment extends Fragment {
  
  private ProgressBar progress;
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.fragment_games, container, false);
  
      String url = "http://myurl.com";
      WebView myWebView  = (WebView) rootView.findViewById(R.id.webViewGames);
      myWebView.setWebChromeClient(new myWebViewClient());
      myWebView.getSettings().setJavaScriptEnabled(true);
      progress = (ProgressBar) rootView.findViewById(R.id.progressBar);
      progress.setMax(100);
      myWebView.loadUrl(url);
  
  
      myWebView.setWebViewClient(new WebViewClient() {
  
          @Override
          public boolean shouldOverrideUrlLoading(WebView View, String url) {
              View.loadUrl(url);
              GamesFragment.this.progress.setProgress(0);
              return true;
          }
      });
  
  
      myWebView.setOnKeyListener(new android.view.View.OnKeyListener()
  
      {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
              if (event.getAction() == KeyEvent.ACTION_DOWN) {
                  WebView webView = (WebView) v;
  
                  switch (keyCode) {
                      case KeyEvent.KEYCODE_BACK:
                          if (webView.canGoBack()) {
                              webView.goBack();
                              return true;
                          }
                          break;
                  }
              }
  
              return false;
          }
      });
      return rootView;
  
  }
  
  
  private class myWebViewClient extends WebChromeClient {
      @Override
      public void onProgressChanged(WebView view, int newProgress) {
          GamesFragment.this.setValue(newProgress);
          super.onProgressChanged(view, newProgress);
      }
  }
  
  public void setValue(int progress) {
      this.progress.setProgress(progress);
  }
  
  
  }
  </code></pre>
  
  <p>One interesting thing is that whenever i use Tab1 and Tab2 non of them reloads but when i switch to Tab3 and then goes back to Tab1 then only it reloads.</p>
  
  <p>Any Help would deeply appreciated. </p>