Pregunta

Stupid question:

if context can be obtained from imageView itself, why bother passing it explicitly? what would be wrong if Picasso did something like this:

Picasso.load(url).into(imageView);

instead of

Picasso.with(context).load(url).into(imageView);

?

¿Fue útil?

Solución

A context is used to initialize the disk cache, load local resources, and communicate with content providers and into isn't always the action method that's invoked. There's also get() and fetch().

Otros consejos

ImageView imageView=(ImageView)header.findViewById(R.id.userImage);
Picasso.with(imageView.getContext()).load("https://secure.gravatar.com/avatar/#HASH#?s=64&d=mm&r=g").into(imageView);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top