Avatar ·

AsyncTask is deprecated in Android 11: what alternatives to use in Kotlin?

Hello everyone! I'm a beginner in Android development with Kotlin, and I have a problem. Previously I used AsyncTask for background tasks, such as loading data from the network or working with a database. But recently I learned that starting from Android 11, the AsyncTask API is officially declared deprecated. Now the studio warns that it is not recommended to use it. Here is an example of my old code that I wrote in Kotlin: ```kotlin class MyAsyncTask : AsyncTask() { override fun doInBackground(vararg params: String?): String { // Loading data return params[0] ?: "" } override fun onPostExecute(result: String?) { // Updating UI textView.text = result } } ``` I understand that I need to switch