title: Fragment content not visible when starting app
body: <p>I'm pretty new to using fragments, and to android in general. I tried loading in a fragment and it seemed to work, nothing crashes. But when I look at the app, it's not showing the fragment layout. I've looked at other similar questions and answers but couldn't find anything I did wrong.</p>
  
  <p>main activity xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="groep10.chef.Main"
      android:background="@color/colorPrimary"&gt;
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="?attr/colorAccent"
          android:minHeight="?attr/actionBarSize"
          android:theme="?attr/actionBarTheme" /&gt;
  
      &lt;FrameLayout
          android:id="@+id/fragment_container"
          android:layout_width="0dp"
          android:layout_height="0dp"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintRight_toRightOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/toolbar"&gt;
      &lt;/FrameLayout&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>Main class where the fragment is loaded in to the FrameLayout:</p>
  
  <pre><code>import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.app.FragmentManager;
  import android.os.Bundle;
  
  import groep10.chef.fragments.HomeFragment;
  
  public class Main extends FragmentActivity {
  
      private FragmentManager fm;
      private Fragment mainFragment;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          fm = getSupportFragmentManager();
          mainFragment = fm.findFragmentById(R.id.fragment_container);
  
          if (mainFragment == null) {
              mainFragment = new HomeFragment();
              fm.beginTransaction()
                      .add(R.id.fragment_container, mainFragment)
                      .commit();
          }
  
      }
  }
  </code></pre>
  
  <p>HomeFragment, my own extended Fragment where correct layout for this fragment is loaded:</p>
  
  <pre><code>import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  import groep10.chef.R;
  
  public class HomeFragment extends Fragment {
      @Override
      public void onCreate(Bundle savedInstancestate) {
          super.onCreate(savedInstancestate);
      }
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup parentVG,
                               Bundle savedInstanceState) {
          View v = inflater.inflate(R.layout.home_screen, parentVG, false);
          System.out.println("Testjeeuh");
          return v;
      }
  }
  </code></pre>
  
  <p>Not really necessary I think, but the layout xml for the Home Fragment:</p>
  
  <pre><code>&lt;ScrollView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/scrollView"
      android:layout_width="0dp"
      android:layout_height="0dp"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/toolbar"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"
          android:paddingLeft="20dp"
          android:paddingRight="20dp"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_gravity="center"
              android:layout_marginBottom="20dp"
              android:layout_marginTop="20dp"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:id="@+id/recipeButtonExpl"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="5dp"
                  android:text="@string/recipeButtonExpl"
                  android:textAlignment="center"
                  android:textColor="#EBEBEB"
                  app:layout_constraintBottom_toTopOf="@+id/recipeButtonText"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  app:layout_constraintVertical_bias="1.0" /&gt;
  
              &lt;Button
                  android:id="@+id/recipeButtonText"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@drawable/my_button"
                  android:paddingBottom="40dp"
                  android:paddingTop="40dp"
                  android:text="@string/recipeButtonText"
                  android:textColor="#EBEBEBEB"
                  app:layout_constraintBottom_toTopOf="@+id/recipeButton2Text"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_gravity="center"
              android:layout_marginBottom="20dp"
              android:layout_marginTop="20dp"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:id="@+id/recipeButton2Expl"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:width="200dp"
                  android:text="@string/recipeButtonTwoExpl"
                  android:textAlignment="center"
                  android:textColor="#EBEBEB"
                  app:layout_constraintBottom_toTopOf="@+id/recipeButton2Text"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  app:layout_constraintVertical_bias="1.0" /&gt;
  
              &lt;Button
                  android:id="@+id/recipeButton2Text"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@drawable/my_button"
                  android:paddingBottom="40dp"
                  android:paddingTop="40dp"
                  android:text="@string/recipeButtonTwoText"
                  android:textColor="#EBEBEB"
                  app:layout_constraintBottom_toBottomOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_gravity="center"
              android:layout_marginBottom="20dp"
              android:layout_marginTop="20dp"
              android:gravity="center"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:id="@+id/shoppingButtonExpl"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="@string/shoppingButtonExpl"
                  android:textAlignment="center"
                  android:textColor="#EBEBEB"
                  app:layout_constraintBottom_toTopOf="@+id/shoppingButtonText"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  app:layout_constraintVertical_bias="1.0" /&gt;
  
              &lt;Button
                  android:id="@+id/shoppingButtonText"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@drawable/my_button"
                  android:paddingBottom="40dp"
                  android:paddingTop="40dp"
                  android:text="@string/shoppingButtonText"
                  android:textColor="#EBEBEB"
                  app:layout_constraintBottom_toBottomOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toBottomOf="@+id/recipeButton2Text" /&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>I think it might be an issue with the commit not working in the Main class, but I wouldn't know why it doesn't work.</p>