Animating Gif for Android

#1

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);
}

#2

@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.