# Animating Gif for Android

**URL:** <https://discourse.processing.org/t/animating-gif-for-android/9738>\
**Category:** Processing for Android\
**Created:** [March 29, 2019, 12:15am UTC](https://discourse.processing.org/t/animating-gif-for-android/9738 "2019-03-29T00:15:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![braingames](https://avatars.discourse-cdn.com/v4/letter/b/34f0e0/32.png) [@braingames](https://discourse.processing.org/u/braingames)\
**Post date:** [March 29, 2019, 12:15am UTC](https://discourse.processing.org/t/animating-gif-for-android/9738/1 "2019-03-29T00:15:06Z")

</div>

Hi I am trying to animate a gif on an Android using processing, but for some reason my gif isn’t being loaded. This is a simple code example from the Android example library.

/\*\*

- Sequential
- by James Patterson.
- 
- Displaying a sequence of images creates the illusion of motion.
- Twelve images are loaded and each is displayed individually in a loop.  
\*/

int numFrames = 12; // The number of frames in the animation  
int frame = 0;  
PImage[] images = new PImage[numFrames];

void setup()  
{  
size(200, 200);  
frameRate(30);

images[0] = loadImage(“animation\_Page\_01.jpg”);  
images[1] = loadImage(“animation\_Page\_02.jpg”);  
images[2] = loadImage(“animation\_Page\_03.jpg”);  
images[3] = loadImage(“animation\_Page\_04.jpg”);  
images[4] = loadImage(“animation\_Page\_05.jpg”);  
images[5] = loadImage(“animation\_Page\_06.jpg”);  
images[6] = loadImage(“animation\_Page\_07.jpg”);  
images[7] = loadImage(“animation\_Page\_08.jpg”);  
images[8] = loadImage(“animation\_Page\_09.jpg”);  
images[9] = loadImage(“animation\_Page\_10.jpg”);  
images[10] = loadImage(“animation\_Page\_11.jpg”);  
images[11] = loadImage(“animation\_Page\_12.jpg”);

// If you don’t want to load each image separately  
// and you know how many frames you have, you  
// can create the filenames as the program runs.  
// The nf() command does number formatting, which will  
// ensure that the number is (in this case) 4 digits.  
//for(int i=0; i\<numFrames; i++) {  
// String imageName = “PT\_anim” + nf(i, 4) + “.gif”;  
// images[i] = loadImage(imageName);  
//}  
}

void draw()  
{  
frame = (frame+1) % numFrames; // Use % to cycle through frames  
//image(images[frame], 50, 50);  
}

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [March 30, 2019, 10:08am UTC](https://discourse.processing.org/t/animating-gif-for-android/9738/2 "2019-03-30T10:08:29Z")

</div>

@braingames ===  
Have you tried the example with .gif (not .jpg) from Patterson : i have verified (android 26): it works…So the problem is probably with your images.
