Default MemoryCachePolicy fails in a RecyclerView (default imageLoader & default parameters)
See original GitHub issueWhen I load an Image from an URL with the following code and reopen this screen, the ImageViews are mostly just blank. (probably due to caching issues)
fun ImageView.loadUrl(url: String) {
load(url)
}
When I change the CachePolicy of the memoryCache to anything except CachePolicy.ENABLED (even to READ) the images are shown properly on every attempt, e.g.:
fun ImageView.loadUrl(url: String) {
load(
uri = url,
builder = {
memoryCachePolicy(CachePolicy.READ_ONLY)
}
)
}
I guess the expected behaviour would be showing the cached bitmap, and then replace with the image from the network call. When I tried to debug this with the callbacks in target, onStart and onSuccess were successfully called. Unfortunately I cannot view the bitmap on debug there because of bitmap configuration issues.
coil 0.11.0 Pixel 4
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Getting Started - Coil
ImageLoader s handle caching, data fetching, image decoding, request management, bitmap pooling, memory management, and more. The default Coil artifact ( io.
Read more >how to display default image in recycler view - Stack Overflow
if you use volley ,you can do this : ImageListener listener = ImageLoader.getImageListener(imageView, R.drawable.default_image, ...
Read more >RecyclerView.Adapter - Android Developers
The default implementation of this method returns NO_ID . Parameters. int position. Adapter position to query. Returns ...
Read more >Using the RecyclerView | CodePath Android Cliffnotes
You may notice an error that says "There is no default constructor available in androidx.recyclerview.widget.ListAdapter ". The reason is that you will declare ......
Read more >Everything You Should Know To Create A Recyclerview
The third parameter is a boolean, when set true, items are shown in reverse order. Default Linear Layout: // get the reference of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
When i tried to build a small sample, I found the source of this issue:
The RecyclerView had
hasFixedSize = true
and the list got an empty list, and afterwards the real dataset, which was causing the issue obviously. I have still no idea, why it worked at the first attempt, and failed at the second one, and why the memory-caching of coil is affected by that.Nevertheless thanks for your support.
Hmm those logs are the expected behaviour. Do you have a small sample that reproduces the bug? It’s not clear what the root cause is based on the logs and I’m not able to reproduce locally.