title: Load fragments inside fragment in Kotlin
body: <p>I have an app structure in mind:</p>
  
  <p>DashBoard Activity</p>
  
  <ul>
  <li>HomeFragment
  
  <ul>
  <li>AdsFragment</li>
  <li>GreetingFragment</li>
  <li>ExperienceFragment</li>
  </ul></li>
  </ul>
  
  <p>WIth that in mind, I'm trying to load different fragments in <code>HomeFragment</code>, which is also a fragment</p>
  
  <p>I've written the following code in HomeFragment's <code>onCreateView()</code></p>
  
  <pre><code>val fm : FragmentManager = childFragmentManager
          val container = R.id.greetingFragmentContainer
          val greetingFragment : Fragment? = fm.findFragmentById(R.id.fragmentGreeting)
          if (greetingFragment != null) {
              fm.beginTransaction().replace(container, greetingFragment).commit()
          } else {
              Log.e("HomeFragment", "Fragment not found")
          }
  </code></pre>
  
  <p><code>fragment_greeting.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout
      android:id="@+id/fragmentGreeting"
      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="._fragments.dash.GreetingFragment"&gt;
  
      &lt;ImageView
          android:id="@+id/profile_image"
          android:layout_width="96dp"
          android:layout_height="96dp"
          android:src="@drawable/loading"/&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>Using that if statement, I found out that the <code>greetingFragment</code> value was returning null.</p>
  
  <p>What am I doing wrong?</p>