Getting your code to load and play animated GIFs is a struggle a lot of new coders go through. It is also a topic that is heavily discussed between developers. This blog will show you a few methods that may be a solution you are looking for. This is the 3rd and final part of a 3 part series showing you 3 different ways to load animated GIFs.
Find an animated GIF and in my code examples switch your animated GIF filename with the filename I use in the code, gif betty boop glitter 108.gif. Store your GIF file in your Eclipse ASSET folder. Be sure you do this or these code examples will not work for you.
This time we will be using a WebView which is by far the easiest method since it has capabilities like a browser. So we have to extend our class by a WebView and create a constructor taking a context and a path to the file using loadUri(), loading the file into our WebView.
Go back to the Activity we created in Part 1 of this series. Create our view and pass it a context and path to our GIF file.
That's it. This method is highly recommended if you know your target audience will be using Android 2.2+.