-
-
Save ryands/10499163 to your computer and use it in GitHub Desktop.
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
@Override | |
protected void onResume() { | |
super.onResume(); | |
loadImageWhenReady(imageView, mPayload); | |
} | |
private static void loadImageWhenReady(final ImageView v, final String url) { | |
v.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | |
@Override | |
public void onGlobalLayout() { | |
Picasso.with(v.getContext()) | |
.load(url) | |
.resize(imageView.getMeasuredWidth(), imageView.getMeasuredWidth()) | |
.centerInside() | |
.into(v); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment