Is Glide or Picasso used with local resources?
I have an imageview in a recycler that is also a shared item with an activity detail.
How do I upload that image in the imageview with Glide or Picasso?
Is Glide or Picasso used with local resources?
I have an imageview in a recycler that is also a shared item with an activity detail.
How do I upload that image in the imageview with Glide or Picasso?
Glide With glide, it is done in a similar way:
Glide.with(context).load(R.drawable.android).into(imageView);
adding the dependency within your build.gradle file:
dependencies {
...
compile 'com.github.bumptech.glide:glide:3.7.0'
...
}
Picasso:
With Picasso you can upload images defined in the resources for example an image called android.jpg
within /drawable
:
ImageView imageView = (ImageView) findViewById(R.id.imageView);
Picasso.with(context).load(R.drawable.android).into(imageView);
adding the respective dependency within your file build.gradle
:
dependencies {
...
compile 'com.squareup.picasso:picasso:2.5.2'
...
}
with both options you would have the same result:
You can also download an image from an url, in this case instead of the reference to the directory /drawable
a url is defined:
Glide:
Glide.with(context).load(imageUrl).into(imageView);
Picasso:
Picasso.with(context).load(imageUrl).into(imageView);