Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why would like to load the picture flash? #1557

Closed
h1091129209 opened this issue Oct 31, 2016 · 8 comments
Closed

Why would like to load the picture flash? #1557

h1091129209 opened this issue Oct 31, 2016 · 8 comments
Labels

Comments

@h1091129209
Copy link

h1091129209 commented Oct 31, 2016

I was just on the same ImageView every 500 ms to load another network picture, why would flash it? I hope it doesn't flash.
With the.DontAnimate () or so.

gif5

I hope it's like this.
Uploading gif5新文件 (1).gif…

@TWiStErRob
Copy link
Collaborator

TWiStErRob commented Oct 31, 2016

Please fill in the issue template? What are you trying to do? That looks like dontAnimate works as expected.

@h1091129209
Copy link
Author

@TWiStErRob I was just on the same ImageView every 500 ms to load another network picture, why would flash it? I hope it doesn't flash.

@TWiStErRob
Copy link
Collaborator

You didn't show any code yet, but I guess you're using

Glide...load(url).dontAnimate().into(imageView);

which is equivalent to

Glide...load(url).dontAnimate().placeholder(null).into(imageView);

When Glide starts a load it immediately (sync) sets the placeholder and then fires up the load on a background thread to deliver it later and set the image (async on UI). The time between this sync and async operation is what you see as fashing.

Read #527 and related issues for more info.

@h1091129209
Copy link
Author

@TWiStErRob Glide...load(url).dontAnimate().placeholder(null).into(imageView); This is not used

@h1091129209
Copy link
Author

@TWiStErRob Glide.with(MainActivity.this).load(str[msg.what-1]).dontAnimate().placeholder(iv.getDrawable()) This can be solved

@TWiStErRob
Copy link
Collaborator

TWiStErRob commented Oct 31, 2016

That won't work, because what is returned from iv.getDrawable() becomes invalid after into is called. So right when the statement finishes executing. Your app will very likely crash if you do that. See comments below where you got that (I also edited that comment to call this out).

@h1091129209
Copy link
Author

@TWiStErRob Do you have a better way?

@TWiStErRob
Copy link
Collaborator

Yes, #527 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants