title: (Need Explanation) Don't get what fragment code means
body: <p>I'm trying to understand this part of the code from 11.3 of <a href="http://www.vogella.com/tutorials/AndroidFragments/article.html#fragments_tutorial_listfragment" rel="nofollow">THIS SITE</a>:</p>
  
  <pre><code>if (fragment != null &amp;&amp; fragment.isInLayout()) {
    fragment.setText(link);
  } else {
    Intent intent = new Intent(getApplicationContext(),
        DetailActivity.class);
    intent.putExtra(DetailActivity.EXTRA_URL, link);
    startActivity(intent);
  
  }
  </code></pre>
  
  <p>The site says that <code>Detail Activity</code> is called when no other fragments are present in the layout. What does that mean? Won't there always be a fragment in the layout? </p>
  
  <p>I think I'm more confused at which file gets run first because I'm not sure how the application would know which layout to use in case of portrait or landscape orientation. Is there a part in the code which tells the app to use a specific set of instructions for each orientation?</p>
  
  <p>Thanks, any help is appreciated.</p>