18

I update my glide to 4.3.1 but all over I use glide the feature .override() and .placeholder() get error: cannot find symbol method.

Glide.with(this)
            .load(imageUrl)
            .override(200, 200)
            .placeholder(R.drawable.ic_avatar_sign_up)
            .into(ivAvatar);

How can I fix this?

Zoe stands with Ukraine
  • 25,310
  • 18
  • 114
  • 149
Mohammad Hadi
  • 1,538
  • 3
  • 20
  • 36

2 Answers2

40

You should use RequestOptions

Includes methods like:

  • centerCrop()
  • placeholder()
  • error()
  • priority()
  • diskCacheStrategy()
  • priority()
  • override(100, 100)
  • transforms()

Sample code

Glide.with(this)
     .load(YOUR_URL)
     .apply(new RequestOptions().override(100, 100).placeholder(R.drawable.placeHolder).error(R.drawable.error_pic))
     .into(imageview);
Goku
  • 8,341
  • 7
  • 43
  • 73
  • Just a note, I was not able to make it work with the property .transition(DrawableTransitionOptions.withCrossFade()) on Glide 4.9.0 – Bernas Sep 06 '19 at 14:19
  • does it means that with the DrawableTransformation the override method doesn't work? – Andrey Sep 19 '19 at 22:37
4

Try This

Glide.with(this)
     .load(imageUrl)
     .apply(new RequestOptions().placeholder(R.drawable.ic_launcher).override(200, 200))
     .into(ivAvatar);
Goku
  • 8,341
  • 7
  • 43
  • 73
Ratilal Chopda
  • 4,113
  • 4
  • 17
  • 29