2021-07-01から1ヶ月間の記事一覧
ネタバレあり
kotlin.github.io CoroutineScopeは実装することが出来る。 interface CoroutineScope CoroutineScope概要 launchやasyncといった全てのコルーチンビルダーはCoroutineScopeを拡張し、全ての要素とキャンセルを自動的に伝播するために、そのcoroutineContext…
developer.android.com Android KTXとは Android JetpackのKotlin拡張をまとめたライブラリ。 以下のKotlinの機能を用いた拡張が用意されている Extension functions Extension properties Lambdas Named parameters Parameter default values Coroutines サ…
ViewModel import androidx.lifecycle.ViewModel class UserViewModel(name: String, age: Int, gender: Int) : ViewModel() { val name = name val age = age val gender = gender } ViewModelProviderを使う val viewModel = ViewModelProvider(this, obje…