coil-base / coil.target / PoolableViewTarget

PoolableViewTarget

interface PoolableViewTarget<T :View> :ViewTarget<T>

A ViewTarget that supports Bitmap pooling.

Implementing PoolableViewTarget opts this target into bitmap pooling. This allows Coil to re-use Bitmaps given to this target, which improves performance.

To opt out of bitmap pooling, implement ViewTarget instead.

Implementing PoolableViewTarget requires that you must stop using the previous Drawable as soon as the next PoolableViewTarget lifecycle method is called; one of:

Target.onStart, Target.onSuccess, Target.onError, PoolableViewTarget.onClear.

For example, a PoolableViewTarget must stop using the placeholder drawable from Target.onStart as soon as Target.onSuccess is called.

Continuing to use the previous Drawable after the next lifecycle method is called can cause rendering issues and/or throw exceptions.

See Also

ViewTarget

ImageViewTarget

Functions

Name Summary
onClear Called when the current drawable is no longer usable. Targets must stop using the current Drawable.abstract fun onClear():Unit

Inheritors

Name Summary
ImageViewTarget A Target that handles setting images on an ImageView.open class ImageViewTarget :PoolableViewTarget<ImageView>,TransitionTarget<ImageView>,DefaultLifecycleObserver