Last active
December 20, 2020 20:09
-
-
Save andreyfomenkov/1e02ba9693a3f9b0850b446c1eb717f9 to your computer and use it in GitHub Desktop.
Now OK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WeatherActivity : AppCompatActivity() { | |
private val thermometer = Thermometer.getInstance() | |
private var disposable: Disposable? = null | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
disposable = thermometer // Save the result of subscribe() method | |
.observeTemperature() | |
.subscribe { celsius -> /* Display in a TextView */ } | |
} | |
override fun onDestroy() { | |
disposable?.dispose() // Do not forget to dispose a resource! | |
super.onDestroy() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment