title: Android Fragment Tab with webview savedInstanceState always null on orientation change
body: <p>After many many days of searching and trying different options I still haven't found the answer. </p>
  
  <p>Using ActionBarSherlock I have a basic SherlockFragmentActivity implementing ActionBar.ITabListener</p>
  
  <p>The fragments contain a simple webview. During a config change (screen orientation change The onCreateView parameter of savedInstanceState is always null so I can never RestoreState. </p>
  
  <p>I have made this as simple as possible to hopefully get more help. so the names are silly.</p>
  
  <p>TabFragWebActivity</p>
  
  <pre><code>public class TabFragWebActivity : SherlockFragmentActivity, Com.Actionbarsherlock.App.ActionBar.ITabListener
  {
  
      protected override void OnCreate (Bundle savedInstanceState)
      {
          base.OnCreate (savedInstanceState);
          SetContentView (Resource.Layout.fragment_tabs);
          LoadTabs();
      }
  
      public void LoadTabs ()
      {
          this.RunOnUiThread (() =&gt; {
              SupportActionBar.NavigationMode = Com.Actionbarsherlock.App.ActionBar.NavigationModeTabs;
  
              var tab = SupportActionBar.NewTab ();
              tab.SetContentDescription ("desc 1");
              tab.SetText ("tab 1");
              tab.SetTag ("tab1id");
              tab.SetTabListener (this);
  
              SupportActionBar.AddTab (tab);  
  
  
              tab = SupportActionBar.NewTab ();
              tab.SetContentDescription ("desc 2");
              tab.SetText ("tab 2");
              tab.SetTag ("tab2id");
              tab.SetTabListener (this);
  
              SupportActionBar.AddTab (tab);  
  
          });
      }
  
      #region ITabListener implementation
  
      public void OnTabReselected (Com.Actionbarsherlock.App.ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction transAction)
      {
          //throw new NotImplementedException ();
      }
  
      public void OnTabSelected (Com.Actionbarsherlock.App.ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction transAction)
      {
          string tag = tab.Tag.ToString();
  
          var fragment = SupportFragmentManager.FindFragmentByTag (tag);
          if (fragment != null) {
              transAction.Show(fragment);
              return;
          }
  
          fragment = new WebFragment("http://www.google.com");
          transAction.Add(Resource.Id.realtabcontent, fragment, tag);
      }
  
      public void OnTabUnselected (Com.Actionbarsherlock.App.ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction transAction)
      {
          string tag = tab.Tag.ToString();
  
          HideFragment(transAction, tag);
      }
  
      public void HideFragment (Android.Support.V4.App.FragmentTransaction transAction, string tag)
      {
          Android.Support.V4.App.Fragment fragment;
          fragment = SupportFragmentManager.FindFragmentByTag (tag);
          if (fragment != null) {
              transAction.Hide (fragment);
          }
      }
  
      #endregion
  
  }
  </code></pre>
  
  <p>WebFragment</p>
  
  <pre><code>    public class WebFragment : SherlockFragment
  {
      string _webURL;
      WebView _webview;
      Activity _activity;
  
      public WebFragment (string webURL)
      {
          _webURL = webURL;
      }
  
      public override void OnAttach (Android.App.Activity activity)
      {
          _activity = activity;
          base.OnAttach (activity);
      }
  
      public override void OnActivityCreated (Bundle savedInstanceState)
      {
          base.OnActivityCreated (savedInstanceState);
          RetainInstance = true;
          if (_webview == null)
              initUI();
      }
  
      public void initUI ()
      {
          _webview = (WebView)_activity.FindViewById (Resource.Id.webView);   
          if (_webview != null) {
              _webview.SetWebChromeClient (new ROSWebChromeClient ());
              _webview.SetWebViewClient (new ROSWebViewClient ());
              _webview.Settings.JavaScriptEnabled = true;
              _webview.LoadUrl (_webURL);
          }
      }
  
      public override Android.Views.View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
      {
          var mainView = (View)inflater.Inflate (Resource.Layout.fragment_web, container, false);
  
          //the savedInstanceState is always null
          if (_webview != null) {
              _webview.RestoreState (savedInstanceState);
          }
  
          return mainView;
      }
  }
  </code></pre>
  
  <p>I hope I am doing something simple wrong. But I just don't know what it is.</p>