android / android-ktx

A set of Kotlin extensions for Android app development.
https://android.github.io/android-ktx/core-ktx/
7.46k stars 563 forks source link

Offer: AsyncTask replacement #590

Open mice777 opened 6 years ago

mice777 commented 6 years ago

I have created Kotlin replacement for Android's AsyncTask. It's well tested on few larger projects of mine, it works beautifully and would fit this library.

Example:

asyncTask({
  doSomething()
}){ result ->
  processResult(result)
}

It's cancelable, it has optional callbacks when it's done or canceled, it passes return value from async thread back to main thread.

If there is interest, I can create pull request with this functionality.