https://kotlinlang.org logo
#android
Title
# android
k

Kevin Janvier Chinabalire

03/12/2018, 5:33 AM
Does anyone uses Coroutine with Retrofit here ??? Any link of a tutorial i can use ??? i want to implement it
k

Kevin Janvier Chinabalire

03/12/2018, 5:36 AM
Thank @gildor.. do u have a video link too?
g

gildor

03/12/2018, 5:37 AM
Video link for what? Video tutorial?
k

Kevin Janvier Chinabalire

03/12/2018, 5:37 AM
yea video tutorial // i tried
youtube but not getting it well
g

gildor

03/12/2018, 5:38 AM
It is a couple of a pretty simple libraries, just check Readme, don’t see any reason to have video tutorial for a lib with a couple classes
If you not familiar with coroutines in general, please take a look to documentation section of kotlinx.coroutines: https://github.com/Kotlin/kotlinx.coroutines#documentation
k

Kevin Janvier Chinabalire

03/12/2018, 5:40 AM
many thanks .. i have an app i build but is taking long to display data to the ui so i thought using coroutine can solve it .. many thanks man
g

gildor

03/12/2018, 5:40 AM
Also you can find a couple videos from Roman Elizarov, author of coroutines from JetBrains:

https://www.youtube.com/watch?v=_hfBv0a09Jc

https://www.youtube.com/watch?v=YrrUCSi72E8

There is nothing special about usage Coroutines with Retrofit, especially when adapter libraries already available
k

Kevin Janvier Chinabalire

03/12/2018, 5:42 AM
Thanks.. i will give it a
short
... hope it will solve my problems
g

gildor

03/12/2018, 5:42 AM
i have an app i build but is taking long to display data to the ui
Not sure what do you mean. Coroutines cannot make data downloading faster, coroutines about a different way to work with callbacks and async APIs
k

Kevin Janvier Chinabalire

03/12/2018, 5:46 AM
okay .. i do understand that why i wanted to use coroutine by thinking it will help to run data in the background and display them when it available ..
let me do some googling
cz i deployed my app yesterday then i saw that problem
g

gildor

03/12/2018, 5:49 AM
Retrofit already run request in background if you use async API. Probably you misunderstood your problem, before rewriting, try to understand the source of you problem
p

Pierre-Luc Paour

03/12/2018, 8:39 AM
@gildor I use your small lib in all my Retrofit projects. I really like how you make it easy to get a Response or a Result. I've used a similar approach to adapt other async APIs to coroutines, thank you!
g

gildor

03/12/2018, 8:42 AM
@Pierre-Luc Paour Thanks, glad to hear 🙏 It’s not my invention of course, quite common patter in Functional Programming (ADT) But it works pretty well with Retrofit 👍
12 Views