title: NullPointerException At Creating view with fragment inside fragment Kotlin
body: <p>When i start the activity that contains a NavigationDrawer with a TabLayout inside it appears a bug report that says that viewPager must not be null.
  Here is the code where the error occurs, in the line where is viewPager.adapter = adapter ...</p>
  <p>Hope that someone can tell me how to fix this.</p>
  <p>I was thinking that i need a method that creates those fragments</p>
  <pre><code>class fragment_nav_home : Fragment() {
  
      private fun setUpTabs() {
          val adapter = ViewPagerAdapter(childFragmentManager)
  
          adapter.addFragment(fragment_tab_artists(), &quot;Artists&quot;)
          adapter.addFragment(fragment_tab_agencies(), &quot;Agencies&quot;)
  
          viewPager.adapter = adapter
  
          tabs.setupWithViewPager(viewPager)
      }
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
  
          setUpTabs()
      }
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View? {
          // Inflate the layout for this fragment
          // setUpTabs()
          return inflater.inflate(R.layout.fragment_nav_home, container, false)
      }
  }
  </code></pre>
  <p>The functions addFragment cames from the next Kotlin class</p>
  <pre><code>class ViewPagerAdapter(supportFragmentManager: FragmentManager) :
      FragmentPagerAdapter(supportFragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
      private val lstFragments = ArrayList&lt;Fragment&gt;();
      private val lstFragmentsTitles = ArrayList&lt;String&gt;();
  
      override fun getCount(): Int {
          return lstFragments.size
      }
  
      override fun getItem(i: Int): Fragment {
          return lstFragments[i]
      }
  
      override fun getPageTitle(i: Int): CharSequence? {
          return lstFragmentsTitles[i]
      }
  
      fun addFragment(fragment: Fragment, title: String) {
  
          lstFragments.add(fragment)
          lstFragmentsTitles.add(title)
      }
  }
  </code></pre>