Last active
March 16, 2016 12:27
-
-
Save davidtcdeveloper/d0ea9ceca1e6b989ba18 to your computer and use it in GitHub Desktop.
Loading fixed size image into a custom target with picasso.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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