title: setTargetFragment in dialogfragment not work - android
body: <p>I am calling a <code>DialogFragment</code> in another <code>fragment</code> like bellow:</p>
  
  <pre><code>@CoursesFragmentScope
  class CoursesFragment : DaggerFragment(),
      DefaultLifecycleObserver,
      CourseTypeListDialogFragment.ApplySelectedCourseTypeFilter {
      @OnClick(R.id.btnCourseType)
      fun btnCourseTypeClick() {
  
          val fm = activity!!.supportFragmentManager
          val courseTypeListDialogFragment =
              CourseTypeListDialogFragment()
          courseTypeListDialogFragment.isCancelable = false
          courseTypeListDialogFragment.setStyle(
              DialogFragment.STYLE_NO_TITLE,
              0
          )
          courseTypeListDialogFragment.setTargetFragment(this, 1)
          courseTypeListDialogFragment.show(fm, "")
      }
  }
  </code></pre>
  
  <p>And my <code>DialogFragment</code> is like bellow:</p>
  
  <pre><code>class CourseTypeListDialogFragment: DaggerAppCompatDialogFragment(), CourseTypeAdapter.CourseTypeListener {
      interface ApplySelectedCourseTypeFilter {
          fun applySelectedCourseType()
      }
  ..some code..
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
          ButterKnife.bind(this, view)
          iApplySelectedCourseTypeFilter = targetFragment as ApplySelectedCourseTypeFilter
       }
  ..some code..
  }
  </code></pre>
  
  <p>But get me bellow <code>error</code> in this line:</p>
  
  <pre><code>courseTypeListDialogFragment.setTargetFragment(this, 1)
  </code></pre>
  
  <p>And say me:</p>
  
  <pre><code>Fragment CourseTypeListDialogFragment{92f4a96 (cbe1689e-1367-4436-8de6-3797320e7d41) } declared target fragment CoursesFragment{422cc09 (9d16e30b-fd71-44a8-8c45-8a866b62c135) id=0x7f0800d5} that does not belong to this FragmentManager!
  </code></pre>
  
  <p>What can I do?</p>
  
  <p>Both classes are from same package:</p>
  
  <pre><code>import dagger.android.support.DaggerAppCompatDialogFragment
  import dagger.android.support.DaggerFragment
  </code></pre>
  
  <p>I removed <code>courseTypeListDialogFragment.setTargetFragment(this, 1)</code> and opened dialog but not work my <code>interface</code> in <code>dialog</code>.</p>
  
  <p>I am using from <code>fragments</code> in <code>activity</code> like bellow:</p>
  
  <pre><code>class MainActivity : DaggerAppCompatActivity() {
      @BindView(R.id.nav_view)
      lateinit var navView: BottomNavigationView
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super&lt;DaggerAppCompatActivity&gt;.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
          ButterKnife.bind(this)
  
          val navController = findNavController(R.id.nav_host_fragment)
          navView.setupWithNavController(navController)
          navView.menu.findItem(R.id.navigation_courses).setIcon(
              IconDrawable(this, MaterialCommunityIcons.mdi_account_box)
                  .colorRes(R.color.colorPrimaryDark)
                  .actionBarSize())
  
          navView.menu.findItem(R.id.navigation_login).setIcon(
              IconDrawable(this, MaterialCommunityIcons.mdi_login)
                  .colorRes(R.color.colorPrimaryDark)
                  .actionBarSize())
  
      }
  }
  </code></pre>