Skip to content


Targets receive the Drawable result of an ImageRequest. They often act as "view adapters" by taking the placeholder/error/success drawables and applying them to a View (e.g. ImageViewTarget).

Here's the easiest way to create a custom target:

val request = ImageRequest.Builder(context)
        onStart = { placeholder ->
            // Handle the placeholder drawable.
        onSuccess = { result ->
            // Handle the successful result.
        onError = { error ->
            // Handle the error drawable.

There are 2 types of targets:

  • Target: The base target class. Prefer this if the image request isn't tied to a View.
  • ViewTarget: A target with an associated View. Prefer this if the request sets the placeholder/error/success Drawables on a View. Using ViewTarget also binds the request to the View's lifecycle.