Skip to content

Requests

Requests are value objects that provide all the necessary information for an ImageLoader to execute an image request.

Requests can be created a number of ways. This simplest way is to use the trailing lambda syntax:

val request = LoadRequest(context, imageLoader.defaults) {
    data("https://www.example.com/image.jpg")
    crossfade(true)
}

Requests can also be created using typical builder syntax. This works best for Java:

val request = imageLoader.newLoadBuilder(context)
    .data("https://www.example.com/image.jpg")
    .crossfade(true)
    .build()

Once you've created a request, pass it to an ImageLoader to execute it:

imageLoader.load(request)

Optionally, you can use the type-safe load and get extension functions to create and execute requests.

See the API documentation for more information.