Android Coroutines: How to manage async tasks in Kotlin

preview_player
Показать описание
Take a good look at the current state of coroutines support in Android libraries and tools, explore some interesting and not-so-obvious edge cases when dealing with Kotlin code that includes coroutines and interop with Java, and briefly look at some new developments in Kotlin coroutines, namely StateFlow and its comparison with LiveData, and SharedFlow.

Resources:

Related Playlists:

Speaker:
Manuel Vicente Vivo

#featured #android11 #11WeeksOfAndroid
Рекомендации по теме
Комментарии
Автор

Bye bye AsyncTask 😀👋 .... Hello Coroutines!!

goobar
Автор

Thank you so much! It's time to migrate my livedata to flow!

puhgeh
Автор

I am curious why your example observes LiveData or collects Flow directly in the Activity. Isn't it better to use a ViewModel?

igorg.
Автор

Great video! I am looking forward to learning more about coroutines

PatricioMoschcovich
Автор

So... Use or not LiveData? Will there be a stable decision?

TheDnaitsirc
Автор

Snippet at 4:11 has an error:
Single.just(readFromDb())
.subscribeOn(Schedulers.io())

is actually equivalent of
Single.just(readFromDb())
.observeOn(Schedulers.io())
thus readFromDb() will be ran on the thread createWork is called(main?).
And it's not about RxJava, it's about Kotlin(or Java): to call a function(Single.just) we have to calculate its parameters first.

ViTORossonero
Автор

So the live data and the flow (state, shared, channel, etc) will likely to coexist and won't converge?

pavneetsingh
Автор

Is it just me or in the first example the:
val dbData = readFromDb()
should've been "data"?
Looks like you are "uploading" to the remote server, the variable is called "data" and it isn't declared in the fun's scope?

joaquimley
Автор

So what is the rule for collecting flows in UI controllers? asLiveData().observe(..) when I want to observe hot streams as cold flows and when I observe e.g. database?

dannicron
Автор

How do you cancel a job via kotlin coroutines, in the same way you can do for AsyncTask?
For when you have AsyncTask instance, you have a choice, of canceling with and without interruption.
ON kotlin coroutines, I can see that you have to choose it when you create it. Is it correct?

LiranBarsisa
Автор

It should be interesting to show also how to unit test it

mddi
Автор

You guys have made android tough to learn, can't you make it simpler

rpintellicus
Автор

omg... i am just understanding asynTask. It is now deprecated..

thurainbowin
Автор

Nothing better than a new API to easily write gotcha code and break your app !

_checkit
Автор

I used to write Android apps on Java but two years ago I switched to Flutter on Dart.

And never regretted since then. Everything is so much easier in Flutter.

I remember how AsyncTasks first appeared and became recommended, now its deprecated... I'm tired of it frankly speaking.

Why should I learn Kotlin? Why should have created new programming language just for Android?
Kotlin is not used anywhere else

kirill
Автор

How can at the java?..Is it no way?! ㅠㅠ

serensis
Автор

Would have been nice if audio and video were in sync.

okaymak
Автор

Get to the point, too much blablabla!

IOOISqAR
join shbcf.ru