[英]How to store downloaded images in cache
I'm working on a Syllabus application for my project in Android which shows a list of subjects in a RecyclerView
. 我正在为我的Android项目开发教学大纲应用程序,该程序在
RecyclerView
显示了主题列表。 When clicked on a subject, it downloads the image from its URL and displays it in the ImageView
. 单击主题时,它将从其URL下载图像并将其显示在
ImageView
。 I need a code which stores the Image in cache once it is downloaded, so the user doesn't need to download the image from the URL again and again. 我需要一个将图片下载后存储在缓存中的代码,因此用户无需一次又一次从URL下载图片。
Use Picasso library. 使用Picasso库。 Reference - https://guides.codepath.com/android/Displaying-Images-with-the-Picasso-Library
参考-https: //guides.codepath.com/android/Displaying-Images-with-the-Picasso-Library
如果您有很多图像要加载到您的应用程序中,我会提供使用外部存储而不是缓存,因为如果您的应用程序缓存已满,android会删除所有应用程序缓存
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.