Skip to content

Instantly share code, notes, and snippets.

@davidtcdeveloper
Last active March 16, 2016 12:27
Show Gist options
  • Select an option

  • Save davidtcdeveloper/d0ea9ceca1e6b989ba18 to your computer and use it in GitHub Desktop.

Select an option

Save davidtcdeveloper/d0ea9ceca1e6b989ba18 to your computer and use it in GitHub Desktop.
Loading fixed size image into a custom target with picasso.
int imageDimension =
(int) getResources().getDimension(R.dimen.image_size);
Picasso.with(MainActivity.this)
.load("https://source.unsplash.com/random")
.resize(imageDimension, imageDimension)
.centerCrop()
.into(new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
}
@Override
public void onBitmapFailed(Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment