0

So I have some images in the cloud that I can access via direct url. I know the Picasso library can fetch that image from the url passed and then place it in an image view on the screen. But is it possible for it to fetch the image and instead of putting it in an image view to store it as a .jpg file in my drawable folder inside my project?

Reason I am asking is because I want to fetch a bunch of images from the internet to be used somewhere else later in the application and I'd like to refer them through drawables.

Update: I found a solution by using the fetch() method. With this I don't need to keep the images in drawables because it loads all my images from cache to memory for instant access.

nicoqueijo
  • 872
  • 2
  • 11
  • 28
  • I believe image caching is what you are looking for. What would happen if you have shipped your app onto play store, would you still be downloading and saving images into drawable folders?? – stebak Jul 17 '17 at 16:46
  • This is not possible, you can do image caching with Picasso library and it will load automatically from the cache next time you try to load the image. Why exactly would you need this to be possible? – uberchilly Jul 17 '17 at 16:49
  • Look I got to point after some research that Picasso can do this thing but again it will take too much code so i chose okhttp 3 to download a file and then save it to ByteOutputStream then make a drawable out of it https://howtoprogram.xyz/2016/11/17/download-a-file-with-okhttp/ – Anas Aijaz Jul 17 '17 at 16:59

0 Answers0