Skip to content

Instantly share code, notes, and snippets.

@JillevdW
Created December 14, 2017 12:19
Show Gist options
  • Save JillevdW/11792f8ea0bb075eba98fc5b20cab683 to your computer and use it in GitHub Desktop.
Save JillevdW/11792f8ea0bb075eba98fc5b20cab683 to your computer and use it in GitHub Desktop.
AsyncTask Kotlin
class ImageRequest(val url: String): AsyncTask<Void,Void,Bitmap>() {
override protected fun doInBackground(vararg params: Void?): Bitmap {
val bmp = BitmapFactory.decodeStream(URL(url).openConnection().getInputStream())
return bmp
}
override protected fun onPostExecute(result: Bitmap?) {
super.onPostExecute(result)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment