AndroidPub
Published in

AndroidPub

Taking a look at Coil.

An image loading library for Kotlin on Android.

Coil: What is it?

But do we really need another image loading library?

Okay I’m sold, what next?

implementation("io.coil-kt:coil:0.9.1")

Loading an Image

//Loading from a URL
imageView.load("https://via.placeholder.com/600/92c952")
//Loading from an image drawable
imageView.load(R.drawable.some_image_placeholder)
// Loading from a file
imageView.load(File("/path/to/some_image_placeholder.png"))

Let’s explore a little more…

//Applying image loading with configurations
imageView.load("https://via.placeholder.com/600/92c952") {
crossfade(true)
placeholder(R.drawable.placeholder_image)
transformations(CircleCropTransformation())
}
//Custom targets
Coil.load("https://via.placeholder.com/600/92c952"){
target{ drawable ->
//Do something with result e.g apply a filter to greyscale image.
}
}

A little bit of more information on Transformations

Other cool things to note 😎

In Conclusion

--

--

The (retired) Pub(lication) for Android & Tech, focused on Development

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kudzai Chasinda

Android application developer,Web apps developer , UX Design and Material Design Enthusiast.