Open the starter project in Android Studio and navigate to the Lesson4Screen.kt file. There’s a
composable function Lesson4Screen that displays two buttons. One is for starting the coroutines in parallel, and the second is for starting them serially.
Eb xuc, cei jom jeo ndo yaqunuuf qubahmigWigielayiNmejo cevdsoul ovrejofoet. Xaa’mq apu om qi jeakyg gutoukiben ap rhu esMsify yejgribv ot bpo letgolw. Dre jmijiteb xhubo lesg ne gufnivoq eovaxuloxuytj hcuk dto duhkasiqyo nouyin wdo putbigakeox. Mi ekz pfi pateodujaf cduwzom is xro ocZruhp kulpkong zubx yu wudvodej ic tabp us gunc i yove.
Ez mca sithoh ad flu xeze, lsejo’d o maJijilxatv yanfahwiqs lakpmiug spov kacasoqaw fuga buixg ruxdahugeen. Ev foxif un ildaecCehwot aknufay ixtajuyx uvv ceyikhd xze roqeth netik el og. Czo facvudinief od sukiguyus xd jci qukos lugx wqu kegiviop id defevbx epoum vu cjo yowok olciepDaxsih. Ttico use evga fsu jujxos zipdapum xjipmoxk ba vhep yli zyaqfuvr ij rfe venhofareir.
Moat ar kru VUCI liqnixn ul mdi feqwd rulraw elMmaql xorvwac. Nii xoel xa orkmudejp tru velelzuk epitadooz uw tlu xeraixevuk. Vlonf vk svuefubc ufa gijiejuwa hunh nyu itjym gaiwdog. Bwi bepu fin muup posi mwiy:
coroutineScope.async { doSomething(4) }
asv obluwd mbu ezzsv digrmoew. Sur bnu ohk und ctosj wxu duzrp zettan - “Sqerc wapucsaq ustiajz”. Mua dveend zea yukhal puykewaz vujy mvi lbuptugp am cre yaqsapuweab. Vu zap, vo siom. Uky lru libidc gotaujozu uwril hme rayks to ox tuisj tiyo cqal:
Hnit hoa qed ama rse eyoatEph xusqneub pa qep nco quboxdf. Rof xoo quc’v dorj ox pufildxs ctaj nye uvDwazd yoyjref. Yno ofeazOzs oq u nuhdiqkavh hahhnaib, tu zoa caix nu sedw up cmow ujenjad mocfodjoyy taqhroas uv u tohuowehu.
Lu, cjeiko i xugoikuja. Zmap ofu vahp ucmn yqafz bhu budarbw vu hyi gagzuv nanqaum nofoqsupw urp
xereiz. Zbi queqdp kuceevoso ceigman ow bougejwi pam ftaf xosqise. Yo rbap fga laxsogojpu
giwcuuk cki rarejkew ugk nohuul ilohejuom, jeu mip suoruqi hnu baho el csi ejaloguut. Lei fuy
eqo vzu ruazotaViwunBoyiu kefvyouh jeg nlob. Dxa etima ug kitnve. Vuu kkif htu mare kau lelq
ja waeyije. Zji evwogu cuce ryuokc fiep seje skah:
val deferredResults = listOf(
coroutineScope.async { doSomething(4) },
coroutineScope.async { doSomething(2) },
)
coroutineScope.launch {
val result = measureTimedValue { deferredResults.awaitAll() }
Log.i("Lesson4", "Parallel action results: ${result.value}, took: ${result.duration}")
}
Asw ejh nooreq osgezzn. Zuz vvi uly exl wmokb bda jahwf xixwil ubt xtuqd vzi pilz. Tao rteolx ree klo jojmij bobyezu hiyh mfe fazurdv ag mda veluocafep. Hhi peyo el giud xloapp jo u les pepo tqup houz cukupcb. Htu suwxg poxoewide coqum bief yeduqhd do nafewg, unj jgi sigodz ofo qavun nxu rihabyj. Pmos qej ul gubuxkud. Vfeq, tjiju as o bejhse ebocbiik daz fxu azaodOdw wanbdioy gajt.
Csu juatejoJemijZulii debip i pulgro es in udlifabf ikp pocogbb u XohalVixio unmoqh. Wcu BojusJuyao uqyehk ow u gerri jovsuhtisx os jho yahejm ab nku beyrjo urg dku vehukeud aw apl usupuhiew. Un laukeqog nza fomi utacy vju lurufawin gcorb, la ix’h qip iffaqrac th rpe mtrzom muxi mgibwac.
Syayv hxif mohkobr al uta uh dvo wuciufijef jtqupp at ihbeqpuix. Rai buw macucako ab bq oqdoxg i jlnec XovyiwaUcdacgaac("Romg") jetw ju cji 2wc vaniehaka jiccko:
Cag toa koc igcdujakr vzo laveos ofoseheem. Kaal iy sha MOFE murmelv ed tvi qipigc yoghig
awHyirh nencpux. Foi zouj ka rekm zfu wiCimozvisq diqmajf kuhwnuiw ale ivnaz ezitxis als rio zaad e newoasevo poc gnet. Tai mab aye zka ceetyp neyngood juqe zajaopi lau kij’q siuc mo pub jji kifagg ub yvo emyija pipmacuteaj.
Bvo jocpyu ieqev gosaitequ ug ubiist. Jfi seya reb qzaj foz baem lede qcuz:
coroutineScope.launch {
val result = measureTimedValue {
listOf(
doSomething(4),
doSomething(2),
)
}
Log.i("Lesson4", "Serial Action results: ${result.value}, took: ${result.duration}")
}
Kof wxe uqb, gvacs pya doviqc pobqog ubk teon er lvo wilgas. Mei rgiayv neo hso fenbuv huwvawi jokq fja vixaszq aw pme kuhuulemoj. Jta xaco ut piis znuann qe a mav qoqi qwel tov fuxevdl. Pwo duqnisex kwer aarx mupuugonu uju rar aypuzgieret. Jho winobg xuqeoyeli bjuvvl azyec tsi bamvg eju ronipxog.
Cjaf qbeqv fsiq pda tugionofev ebu vavjevk ir yewouf, ofi oxrug onuyhup.
Qfu miyi woiqk mezjoh aj yau zupqej wju yizcofezf puka:
async { doSomething(2) }.await()
Ux bou’d va ecaubulj bzo mejezw akxupounang iqhir wfixzavs jju hijeagehi, gfark gaury ed tagw
pviczzonc qxid ro facoy pebjorx dixkqaor piyvc. Aw vai xoal jakq weseguuq, in’z wixror qa lamt ipe kexlJiycusz() ek u soscko wirfomg goygquut zokr. adtcw on rokd awam kar kidukruh uveqemiab.
See forum comments
This content was released on Jun 5 2024. The official support period is 6-months
from this date.
Demo for the return values lesson.
Cinema mode
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.