I have been playing lately with Picasso as an image loader library. I use it in conjunction with Dagger and OkHtttp.
My only questions regarding this library are the us
It doesn't matter which you choose, when using the default Picasso.with(Context)
method, or the Builder
, it will retrieve the application Context
from the given Context
:
/** Start building a new {@link Picasso} instance. */
public Builder(Context context) {
if (context == null) {
throw new IllegalArgumentException("Context must not be null.");
}
this.context = context.getApplicationContext();
}
Stub copied from Picasso.java#Builder.
If you actually want to create a new instance in each activity:
For each instance of Picasso you create, you basically create a new cache: images cached in the first instance will not be reused in the second instance. You are very likely to run into OutOfMemoryException
s here, as Picasso does not handle this.