Placeholder/Error/Fallback in Glide v4 [duplicate]
Asked Answered
D

2

7

i am using latest version of Glide as of now which is glide:4.0.0-RC1 and not able to find methods like placeholder, error, fallback e.t.c. Probably they have provided alternate for it but i am not getting it. Anybody know about there alternatives in this release?

Distich answered 19/7, 2017 at 10:20 Comment(1)
Read documentation of Glide. There might be given a description.Crash
C
11

try this

RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(R.mipmap.ic_launcher);
requestOptions.error(R.drawable.error_img);

Glide.with(this)
                .setDefaultRequestOptions(requestOptions)
                .load("")
                .into(imageViewPlaceholder);
Confederacy answered 19/7, 2017 at 10:57 Comment(0)
G
1

Checkout migration details from here. Looks like they had lot more improvements.

You have new class RequestOptions:

RequestOptions options = new RequestOptions()
    .centerCrop()
    .placeholder(R.drawable.placeholder)
    .error(R.drawable.error)
    .priority(Priority.HIGH);

Then,

Glide.with(fragment/activity)
    .load(url)
    .apply(options)
    .into(imageView);

To learn more about Migration Details, you can go here.

Gaseous answered 19/9, 2017 at 9:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.