Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glide does not resolve its method

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?

like image 290
user3528954 Avatar asked May 26 '17 10:05

user3528954


People also ask

How does glide work?

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.


1 Answers

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); 
like image 69
PEHLAJ Avatar answered Sep 20 '22 00:09

PEHLAJ