ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

Follow publication

Widgets with Glance: Displaying Images

Katie Barnett
ProAndroidDev
Published in
6 min readJan 17, 2025

--

Displaying drawables

Just a simple happy drawable displaying on a widget. The drawable is emoji by Maxim Kulikov from The Noun Project
Looking pretty. Image from Lorem Picsum

Glance ContentScale options

Displaying an image from a url

Image Bitmap with a background thread

In the above I am explicitly disabling the image caching in the request, but you can alter this depending what your image is used for.
The author information is fetched during the first “Loading”, the image is downloaded while the spinner is displayed.

Image file with a Coroutine Worker

In this case we have enabled the Coil image cache — we want the image to be cached so we can fetch the file from the cache.

Permission handling for File Providers

--

--

Published in ProAndroidDev

The latest posts from Android Professionals and Google Developer Experts.

No responses yet