AsyncTask
is an Android API, not a language feature that is provided by Java nor Kotlin. You can just use them like this if you want:
class someTask() : AsyncTask<Void, Void, String>() {
override fun doInBackground(vararg params: Void?): String? {
// ...
}
override fun onPreExecute() {
super.onPreExecute()
// ...
}
override fun onPostExecute(result: String?) {
super.onPostExecute(result)
// ...
}
}
Anko’s doAsync
is not really ‘provided’ by Kotlin, since Anko is a library that uses language features from Kotlin to simplify long codes. Check here:
If you use Anko your code will be similar to this:
doAsync {
// ...
}