override fun onViewCreated()

in sample/src/main/kotlin/autodispose2/sample/KotlinFragment.kt [63:75]


  override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    Log.d(TAG, "onViewCreated()")
    // Using automatic disposal, this should determine that the correct time to
    // dispose is onDestroyView (the opposite of onCreateView).
    // Note we do this in onViewCreated to defer until after the view is created
    Observable.interval(1, TimeUnit.SECONDS)
      .doOnDispose { Log.i(TAG, "Disposing subscription from onViewCreated()") }
      .autoDispose(AndroidLifecycleScopeProvider.from(viewLifecycleOwner))
      .subscribeBy { num ->
        Log.i(TAG, "Started in onViewCreated(), running until onDestroyView(): $num")
      }
  }