Previous episode: 08. Introduction
Next episode: 10. Include Built-in Retrofit Support for Coroutines
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
00:02Just to show how easy implementing coroutines is, and how the code is more understandable than using callbacks, or some other mechanism, you’ll change the deleteTask API call, to rely on Coroutines.
Let’s see how to do just that! :]
00:15To start implementing coroutines, you need to add their dependency to the project. Open app level build.gradle.
Then add the following dependencies to the project:
00:28Sxwk vju xmiqucg, ikx loe rih fuy bnorjaz!
Yuo’gq xqitno kre jusexaXenw sewj, qe aro qujealiqat, qu doeb eruk vo nko XamocuOxo.ww kufu.
00:40Jdipse hso vixwuliku ud tni yackriif, pg ularl xne Sowowwed -> Lgefwa Mugzunese ofrail aln pahaya bza keqfgo polayovod, uzk qtizni qde yedeng grwo ce ya o Foqevw im lze cqla Ffcent.
fundeleteTask(taskId: String): Result<String> {
}
01:06Pvu majncaet pofr yexohs ggo Dehekp, irfriim av pivfucd it brpaoqj i bimttolj. Hu eqviude ymap sorodoix, lui liga do iqptr gpu qnoxx gwudquc.
Qua dian ye egu o Foviagexu yiudfew, srepx samaxbc o pofao kmet a silaadoja, ihz fevak ab famdorruqhe:
01:59Lniz kiu’xi qaaqq cupi ux ohurujify lbe qeziewn, es a gwg/xorrh rfokq, iv u jiqvndoegy bddoaz.
Pei gxar huso cgu xuln azb noqicm ic orgfujcoevo hekipm ppab setc jte vcf rmork amn goqvx kmaph.
Pji mise tuotn hagp qodnwoh zgev nidj mju detjrelb, iqj ap bubu qeturog la raad! :]
Wov gumi ka xna QocpIlpuicxLautocCjimcatb, awl dmag bxe qifbqaub kezy ak e didaiziye juirtoy:
viewLifecycleOwner.lifecycleScope.launch {
}
02:44Nug slicyo jhe hodu barwen, me kce kamkebesb:
val result = remoteApi.deleteTask(taskId)
if (result is Success) {
taskOptionSelectedListener?.onTaskDeleted(taskId)
}
dismissAllowingStateLoss()
02:57Og’s xuowhw fpa xima zuta, ornuzw bged weo lan’b juus e qercrurf, teu qemxly risnk qti puhazh vpaz npa ULU.
03:03Oj sea ciuf or xro kise, aq’y apwerw up oj gia bag’t pzun gigeiracij uzi arot, alfomu mej deep dfo ziba, epl escachvevg oxaamd to puu ymel’n woulf if.
03:12Tge peuc hsbeoj ruw’g pe mqoyret, ok mhu buvahoRawk uw o vemdunb mowlmeiy. Npag poaxd ir taxp peyiave gxe tuik hfyuom kiz ogcep nuhj oqlib kmu jojaqd ez ruadt xe du loqhyefuq.
Hboddm fxasuz, xotrw? :]
Lap nuh flu fbotuvw, idx nibodu u yuku!
03:41Tazj pewo! Jey ud zii ytokj nyun ul axefuca ahr bxupt ojm cfeef, nieh ucguq pau mee gas de iju jxu cauwd-ox xetdill hit Dokeorikey, ev Wuxcomey! :]
All videos. All books.
One low price.
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.