override fun onCreate()

in sample/src/main/kotlin/autodispose2/sample/KotlinActivity.kt [38:54]


  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    Log.d(TAG, "onCreate()")
    setContentView(R.layout.activity_main)

    // Using automatic disposal, this should determine that the correct time to
    // dispose is onDestroy (the opposite of onCreate).
    Observable.interval(1, TimeUnit.SECONDS)
      .doOnDispose { Log.i(TAG, "Disposing subscription from onCreate()") }
      .autoDispose(scopeProvider)
      .subscribeBy { num -> Log.i(TAG, "Started in onCreate(), running until onDestroy(): $num") }

    supportFragmentManager
      .beginTransaction()
      .add(R.id.fragment_container, KotlinFragment())
      .commitNow()
  }