2

I found picassa allows to load a resource on an image view, e.j: Picasso.with(getContext()).load(R.drawable.ic_car).into(imageView);

What is the advantage of using it rather than just imageView.setResourceId(R.drawable.ic_car)?
Is there an advantage?

Thanks.

eli-bd
  • 1,533
  • 2
  • 17
  • 35
Felipe Porge Xavier
  • 2,236
  • 6
  • 19
  • 27
  • I haven't use it but the only advantage i can think of is, if the drawable is too large to be loaded for the required ImageView's size then it may downsize the Drawable which can save you from OutOfMemory exception. – Muhammad Babar Apr 26 '17 at 06:51

2 Answers2

3

For the example you gave, nothing beyond having all your image loading done in a consistent way.

But, if you want to resize, crop or otherwise transform the image and cache the result then Picasso will handle that for you.

alex
  • 6,359
  • 1
  • 23
  • 21
1

Picasso, Glide, Universal ImageLoader or any other Image caching library meant to provide Image caching If you only want to use with drawable's then it doesn't effect anything because drawable are app resources which always available in memory.

But if you want to load images from the server using URL then real benefit of these libraries come in picture. It already answers lots of time on StackOverflow the benefit of these libs for reference please find those links:-

  1. Why use Android Picasso library to download images?
  2. Picasso v/s Imageloader v/s Fresco vs Glide
  3. Local image caching solution for Android: Square Picasso vs Universal Image Loader
Community
  • 1
  • 1
VikasGoyal
  • 3,308
  • 1
  • 22
  • 42
  • The question is focused on drawables, but thanks for your answer. :D – Felipe Porge Xavier Apr 26 '17 at 03:54
  • 1
    In the first paragraph, I define how it behave with drawable's and after I try to focus on the main benefit of these libs but it's okay if you are looking for something else, and thanks for being nice gesture. – VikasGoyal Apr 26 '17 at 03:59