title: Why is my onCreateView method being called twice?
body: <p>While debugging another issue, I realized that the <code>onCreateView</code> method of one of my <strong>activities</strong> was being called twice.  I'm new to programming and I don't fully understand how <code>android</code> calls these methods when the <strong>activity</strong> loads, but it doesn't seem right to me that it would be called twice. Eliminating most of my code, I still see my <code>System.out</code> message twice.</p>
  
  <pre><code>public class AddCourse extends ActionBarActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_add_course);
  
          if (savedInstanceState == null) {
              getSupportFragmentManager().beginTransaction()
                  .add(R.id.container, new AddCourseFragment()).commit();
          }
      }
  
      public static class AddCourseFragment extends Fragment {
  
          View rootView;
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
              rootView = inflater.inflate(R.layout.fragment_add_course,
                  container, false);
                          System.out.println("I see this TWICE!!!!");
              return rootView;
          }       
      }
  }
  </code></pre>
  
  <p>This is almost exactly like my main activity implementation, but that one doesn't go through <code>onCreateView</code> twice. Thoughts?</p>
  
  <p>My <strong>activity_add_course</strong> xml was requested...</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/container"
  android:orientation="horizontal"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
       &lt;fragment android:name="com.NsouthProductions.gradetrackerpro.AddCourse$AddCourseFragment"
           android:id="@+id/AddCourseFrag" 
           android:layout_width="match_parent"
           android:layout_height="match_parent" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>