Comments (6)
This fixed is wrong!
You must put the following code:
if (animationCallback != null) {
animationCallback.onStop();
animationThread = null;
break;
}
inside the do...while loop on run method (at the end position) and remove all the code you added after the while.
It works for me.
from gifimageview.
Why is it wrong?
When the loop breaks, animation stops so onStop should be called there. Instead of putting that block before every break statement in that loop, you just put it outside and it will be called after break.
from gifimageview.
Your code is wrong because the do...while loop never exit so, the code outside that will never be executed!
Did you try your code? Did it work?
from gifimageview.
Yes.
It works because it sets "animating" to true or false depending on the loop count and the frame pointer. In the next iteration of the loop, the "animating" variable is checked three times and the loop breaks if it's false, after which the code will be called.
from gifimageview.
It's very strange: with my animated gif the loop never stops :(
I had to change the code as I told you... Can you send me a gif that works for you?
Thanks
from gifimageview.
It's dependent on the gif. Gifs have metadata to determine how many times they should loop. Now the only thing wrong in that code is that if you have loopCount != 0, then it loops forever instead of looping the correct number of times.
from gifimageview.
Related Issues (20)
- First frame is overlapped over last frame on tranparent animated GIF HOT 4
- ANR exception in Google Play console. HOT 1
- Transparent GIF shows black. HOT 1
- Gif play speed varies from device to device HOT 2
- Does this support Android 4.4.2? HOT 3
- How to Load Gif image from File System HOT 1
- Frame might still get updated after stopAnimation is called
- No resetAnimation() HOT 3
- play animation for only once and stop HOT 1
- How could i get all frames of a .gif and store as jpeg in a folder using your "GifDecoder".
- Add the function from GifDecoder to get total frame count to the library
- cann't stop HOT 2
- NullPointerException HOT 2
- NullPointerException HOT 2
- Crashes in recycler view
- CreateProcess error=2, The system cannot find the file specified HOT 1
- How to display gif image from external storage ? HOT 2
- Stop at specific frame HOT 1
- getting Build failed after migrated to AndroidX HOT 4
- Memory leak due to rapid toggle of animation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gifimageview.