title: fragment_main and activity_main layouts in Android Studio
body: <p>I am confused with the two layout files that are generated by the Android Studio. (fragment_main.xml and activity_main.xml)</p>
  
  <p>I use activity_main.xml. To use activity_main.xml I need to comment out</p>
  
  <pre><code>if(savedInstanceState==null){...} //in onCreate(), Otherwise it will not display
  </code></pre>
  
  <p>Then I can use activity_main.xml.</p>
  
  <p>Can some one explain me </p>
  
  <ol>
  <li><p>when to use Fragment_main.xml</p></li>
  <li><p>Advantage of using both layouts.</p></li>
  <li><p>How to use them correctly.(If I do not comment out above line it will not display activity_main.xml, instead it shows fragment_main layout. That means I need to create the interface in the fragment_main.xml.)</p></li>
  </ol>
  
  <p>Thanks.</p>