title: Best practice to handle orientation change: Android
body: <p>I was going through various practices to handle orientation change with threads and AsyncTask. I came across following solutions: </p>
  
  <ol>
  <li><p><strong>Attach-detach model :</strong> Attaching and detaching activity to threads and AsyncTask while preserving their instance. (Source: <a href="https://github.com/commonsguy/cw-android/blob/master/Rotation/RotationAsync/src/com/commonsware/android/rotation/async/RotationAsync.java" rel="nofollow noreferrer">1</a>, <a href="https://stackoverflow.com/questions/3821423/background-task-progress-dialog-orientation-change-is-there-any-100-working/3821998#3821998">2</a>)</p></li>
  <li><p><strong>Headless fragment way :</strong> Using a non-UI/headless fragment to do all the thread related operations and retaining its instance on configuration change. (Source: <a href="http://www.vogella.com/articles/AndroidFragments/article.html#headlessfragments" rel="nofollow noreferrer">1</a>, <a href="http://techbandhu.wordpress.com/2013/07/02/android-headless-fragment/" rel="nofollow noreferrer">2</a>)</p></li>
  </ol>
  
  <p>Are there any other approaches to handle this scenario? What is the recommended practice? I'm asking this because I couldn't find a generic solution anywhere in the Android docs. </p>