Search code examples
androidkotlinandroid-asynctaskkotlin-coroutines

Does Kotlin Coroutines replace AsyncTask?


Is AsyncTask still needed?

In Android with Java, we used to implement an AsyncTask and AsyncTaskLoader, but recently I've been beginning to learn Kotlin and I've noticed that things like that are done by Kotlin Coroutines.


Solution

  • AsyncTask has been officially deprecated since Android 11.

    https://developer.android.com/reference/android/os/AsyncTask

    Coroutines are the recommended choice, and considering Kotlin is the official language since 2017, then using AsyncTask is no longer a standard option.