title: Android -Retained headless fragment
body: <p>I am reading about how to interact between UI and background thread <a href="http://www.vogella.com/tutorials/AndroidBackgroundProcessing/article.html" rel="noreferrer">here</a>.</p>
  
  <p>This article has following note:</p>
  
  <blockquote>
    <p>The AsyncTask does not handle configuration changes automatically,
    i.e. if the activity is recreated. The programmer has to handle that
    in his coding. A common solution to this is to declare the AsyncTask
    in a retained headless fragment.</p>
  </blockquote>
  
  <p>I dont understand what is retained headless fragment. </p>
  
  <p>For example, in this way I can add fragment:</p>
  
  <pre><code>FragmentManager manager = getSupportFragmentManager();
  FragmentTransaction transaction = manager.beginTransaction();
  transaction.add(R.id.frame, new MyFragment());
  transaction.commit();
  </code></pre>
  
  <p>And in fragment I can execute AsyncTask like this:</p>
  
  <pre><code>MyTask myTask = new MyTask();
  String[] args = {"Hello"};
  myTask.execute(args);
  </code></pre>
  
  <p>Is this called "to declare the AsyncTask in a retained headless fragment"?</p>