title: Fragment restarts when orientation is changed
body: <p>I have this Hierarchy in my android app</p>
  
  <p>Activity contains the FragmentGame fragment, that contains the FragmentTypeOfGame;</p>
  
  <p>Activity <strong>>></strong> FragmentGame <strong>>></strong> FragmentTypeOfGame</p>
  
  <p>Inside FragmentGame, i got a timer and another labels, so, when I change the screen orientation, my game seems restarted, but i can check the timer keeps running (because it`s another thread, I guess).</p>
  
  <p>So my question is, how can I manage to keep all screen running without restarting.</p>
  
  <p>I have already seem these links, but i can't find out how to solve it?</p>
  
  <p><a href="https://stackoverflow.com/questions/7818717/why-not-use-always-androidconfigchanges-keyboardhiddenorientation">Why not use always android:configChanges=&quot;keyboardHidden|orientation&quot;?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/5933583/forcing-android-to-not-redraw-activity-on-orientation-change">Forcing Android to not redraw activity on orientation change</a></p>
  
  <p>Here goes my manifest:</p>
  
  <p>
      </p>
  
  <pre><code>&lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme"
      &gt;
      &lt;meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/&gt;
      &lt;activity
          android:name=".MainActivity"
          android:label="@string/app_name"
          android:configChanges="orientation"
          &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;activity android:name="com.facebook.FacebookActivity"
          android:configChanges=
              "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
          android:theme="@android:style/Theme.Translucent.NoTitleBar"
          android:label="@string/app_name" /&gt;
  
      &lt;provider android:authorities="com.facebook.app.FacebookContentProviderXXXXXXXXX"
          android:name="com.facebook.FacebookContentProvider"
          android:exported="true" /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here my GameFragment OnCreateView:</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      //Default components start
      defaultComponentsStarting(inflater, container);
  
      FourBlocksGameStyle f = new FourBlocksGameStyle();
      frgManager.beginTransaction().replace(R.id.rl_root, f, "4blocks").addToBackStack(null).commit();
  
      if (savedInstanceState != null) {
          // Restore last state
          actualGameTime = savedInstanceState.getDouble("actualGameTime");
      }
  
      handler = new Handler(Looper.getMainLooper());
      mainRunnable = new Runnable() {
          @Override
          public void run() {
              // Do something and reschedule ourself
  
              if(GAMETIME &lt;= actualGameTime){
                  cancelTimer();
  
                  setLabel(txtTimer, 0, GAMETIME / 1000);
                  int countSum = Integer.parseInt(txtHits.getText().toString());
  
                  //Devolve pra main cuidar da finalização
                  Intent i = new Intent(ctx, MainActivity.class);
                  i.putExtra("CountSum", countSum);
                  startActivity(i);
              }
              else {
                  actualGameTime += GAMEDELAY;
                  double floatingTime = actualGameTime / 1000;
  
                  setLabel(txtTimer, 0, floatingTime);
                  handler.postDelayed(this, GAMEDELAY);
              }
          }
      };
      return view;
  }
  </code></pre>
  
  <p>and here my MainActivity onCreate?</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      FacebookSdk.sdkInitialize(getApplicationContext());
      setContentView(R.layout.activity_main);
  
      this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
  
      final SharedPreferences prefs = getSharedPreferences("hitColor", MODE_PRIVATE);
      int startHighscore = prefs.getInt("highScore", 0);
  
      gameOver = new GameOverFragment();
      highScoreGameOver = new HighScoreFragment();
      game = new GameFragment();
  
      Intent i = getIntent();
      int countSum = i.getIntExtra("CountSum", -1);
  
      if(countSum == -1) {
          //Log.d("GSS", "Primeira entrada");
          if(savedInstanceState == null) {
              Log.d("GSS", "savedInstace null");
              getFragmentManager()
                      .beginTransaction()
                      .replace(R.id.layout_root_view, game)
                      .addToBackStack(null)
                      .commit();
          }
      }
      else {
          Log.d("GSS", "COUNT: " + String.valueOf(countSum));
          Log.d("GSS", "HIGH: " + String.valueOf(startHighscore));
  
          finishGame(countSum, startHighscore, prefs);
      }
  }
  </code></pre>