Today I'm trying to use Glide
image loader in my android application while using this I had facing method not resolving problem.
Glide .with(this) .load(R.drawable.image_default_profile_picture) .into(mUserImage);
This code working pretty fine. But when I'm trying this
Glide .with(this) .load(R.drawable.image_default_profile_picture) .placeholder(R.mipmap.ic_launcher) .fitCenter() .into(mUserImage);
Then this saying cannot resolve method fitCenter()
, placeholder
. What I am missing?
Glide knows the dimension of the imageView as it takes the imageView as a parameter. Glide down-samples the image without loading the whole image into the memory. This way, the bitmap takes less memory, and the out of memory error is solved.
Seems like updated library has any issue. Add .apply(new RequestOptions()
to continue with latest version.
CODE
Glide .with(this) .load(R.drawable.image_default_profile_picture) .apply(new RequestOptions() .placeholder(R.mipmap.ic_launcher) .fitCenter()) .into(mUserImage);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With