如何将下载的图像存储在缓存中

时间:2018-06-23 11:16:46

标签: java android image

我正在为我的Android项目开发教学大纲应用程序,该程序显示了Frq = 2 df['Time'] = [0,3,4,5,5,5,5,5,6,3.02,2.02] OAS = 2.03 for frq = 2, df['Discount Rate'][0] = 0 # (This will always be zero) df['Discount Rate'][1] = ((step_x['Term'][0]-df['Time'][1])*step_x['diff'][1])+OAS+step_x['Yield'][0] df['Discount Rate'][2] = ((step_x['Term'][3]-df['Time'][2])*step_x['diff'][4])+OAS+step_x['Yield'][3] df['Discount Rate'][3] = ((step_x['Term'][4]-df['Time'][3])*step_x['diff'][5])+OAS+step_x['Yield'][4] df['Discount Rate'][4] = ((step_x['Term'][4]-df['Time'][4])*step_x['diff'][5])+OAS+step_x['Yield'][4] for frq = 1, df['Discount Rate'][0] = 0 # (This will always be zero) df['Discount Rate'][1] = ((step_x['Term'][0]-df['Time'][1])*step_x['diff'][1])+OAS+step_x['Yield'][0] df['Discount Rate'][2] = ((step_x['Term'][4]-df['Time'][2])*step_x['diff'][4])+OAS+step_x['Yield'][4] df['Discount Rate'][3] = ((step_x['Term'][5]-df['Time'][3])*step_x['diff'][5])+OAS+step_x['Yield'][5] df['Discount Rate'][4] = ((step_x['Term'][6]-df['Time'][4])*step_x['diff'][6])+OAS+step_x['Yield'][6] df['Discount Rate'][5] = ((step_x['Term'][6]-df['Time'][5])*step_x['diff'][6])+OAS+step_x['Yield'][6] for frq = 4, df['Discount Rate'][0] = 0 # (This will always be zero) df['Discount Rate'][1] = ((step_x['Term'][0]-df['Time'][1])*step_x['diff'][1])+OAS+step_x['Yield'][0] df['Discount Rate'][2] = ((step_x['Term'][2]-df['Time'][2])*step_x['diff'][3])+OAS+step_x['Yield'][2] df['Discount Rate'][3] = ((step_x['Term'][3]-df['Time'][3])*step_x['diff'][4])+OAS+step_x['Yield'][3] df['Discount Rate'][4] = ((step_x['Term'][4]-df['Time'][4])*step_x['diff'][5])+OAS+step_x['Yield'][4] df['Discount Rate'][5] = ((step_x['Term'][4]-df['Time'][5])*step_x['diff'][5])+OAS+step_x['Yield'][4] df['Discount Rate'][6] = ((step_x['Term'][4]-df['Time'][6])*step_x['diff'][5])+OAS+step_x['Yield'][4] df['Discount Rate'][7] = ((step_x['Term'][4]-df['Time'][7])*step_x['diff'][5])+OAS+step_x['Yield'][4] 中的主题列表。单击主题时,它将从其URL下载图像并将其显示在RecyclerView中。我需要一个将图片下载后存储在缓存中的代码,因此用户无需一次又一次从URL下载图片。

3 个答案:

答案 0 :(得分:1)

要下载图像,可以使用Glide库。该库可让您有效地下载图像并缓存它们,因此您不必手动进行操作。

答案 1 :(得分:0)

答案 2 :(得分:0)

如果您要在应用程序中加载很多图像,我会提供使用外部存储而不是缓存 因为如果您的应用程序缓存已满,Android会删除所有应用程序缓存