0

I am building a multilevel navigation drawer in my application where I would need to cache some 70-80 images which I do not want to download in front of users. Right now, I am using picasso image library which allows me to load images once the app gets started. Load:

Picasso.with(getActionBar().getThemedContext()).load(imageURL);
Setting image in view:
Picasso.with(_context).load(imageURL).into(ImageView);

I want to store the images in user's phone so that the drawer could show them up even when the user is offline. I am not sure if I should use internal or external storage(also how would I use). Is there a way I could store these images in phone using picasso somehow because the effects picasso has for image loading seems good.

If not, how should I go about storing my images? I cannot hardcode this because these images would change every 2-4 days.

duggu
  • 37,851
  • 12
  • 116
  • 113
rahul
  • 43
  • 1
  • 9

1 Answers1

0

You can save the images like this:

File sdcard = Environment.getExternalStorageDirectory();
File f = new File (sdcard, "filename.png");
FileOutputStream out = new FileOutputStream(f);
yourBitmap.compress(Bitmap.CompressFormat.PNG, 90, out)
João Marcos
  • 3,872
  • 1
  • 19
  • 14