title: Kotlin: FragmentManager inside fragment becomes null
body: <p>This is my code:</p>
  
  <pre><code>Places.initialize(context!!, getString(R.string.google_api_key))
          val autocompleteFragment : AutocompleteSupportFragment = fragmentManager?.findFragmentById(R.id.autocomplete_fragment) as AutocompleteSupportFragment
          autocompleteFragment.setCountry("NO")
          autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG, Place.Field.ADDRESS, Place.Field.ADDRESS_COMPONENTS))
  
          autocompleteFragment.setOnPlaceSelectedListener(object : PlaceSelectionListener {
              override fun onPlaceSelected(place: Place) {
                  onPlaceSelectedOverride(place)
                  Log.d("myTag", place.address + " - " + place.addressComponents + " - " + place.latLng)
              }
  
              override fun onError(status: Status) {
                  throw RuntimeException()
              }
          })
  </code></pre>
  
  <p>Problem is the fragmentManager. Previously the code was placed inside onCreate() of the mainActivity, and the code had this difference.</p>
  
  <pre><code>val autocompleteFragment : AutocompleteSupportFragment = supportFragmentManager.findFragmentById(R.id.autocomplete_fragment) as AutocompleteSupportFragment
  </code></pre>
  
  <p>But on moving the code to another fragment, all sorts of problems came about. fragmentManager appears to be null. What is fragmentManager and how can I make this code function inside a fragment?</p>