1
kotlinのAnko coroutinesライブラリには、バックグラウンドスレッド上で簡単にコードを実行できるように、1つの機能bg()があります。返品タイプは延期です。それでは延期?Anko coroutines kotlinで延期されるものは何ですか?
Refrenceリンク
fun getData(): Data { ... }
fun showData(data: Data) { ... }
async(UI) {
val data: Deferred<Data> = bg {
// Runs in background
getData()
}
// This code is executed on the UI thread
showData(data.await())
}
「遅延」は、コトリン特有の未来/約束です。それから何が問題なの? –
私の質問は、Deferredとは何ですか? –