# Can everyone Help me?

**URL:** <https://discourse.processing.org/t/can-everyone-help-me/26661>\
**Category:** Processing for Android\
**Created:** [December 31, 2020, 11:23pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661 "2020-12-31T23:23:58Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [December 31, 2020, 11:23pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/1 "2020-12-31T23:23:58Z")

</div>

Pls Help me i become a Error

java.lang.ArraylndexOutOfBoundsException: length=16; index=16

```auto
int numFrames = 16; // The number of frames in the animation
int frame = 17;
PImage[] images = new PImage[numFrames];
int j= year();
int mt= month();
int t= day();
int s= second();
int m= minute();
int h= hour();

void setup(){
  images[0] = loadImage("1.gif");
  images[1] = loadImage("2.gif");
  images[2] = loadImage("3.gif");
  images[3] = loadImage("4.gif");
  images[4] = loadImage("5.gif");
  images[5] = loadImage("6.gif");
  images[6] = loadImage("7.gif");
  images[7] = loadImage("8.gif");
  images[8] = loadImage("9.gif");
  images[9] = loadImage("10.gif");
  images[10] = loadImage("11.gif");
  images[11] = loadImage("12.gif");
  images[12] = loadImage("13.gif");
  images[13] = loadImage("14.gif");
  images[14] = loadImage("15.gif");
  images[15] = loadImage("16.gif");
  images[16] = loadImage("17.gif");
  orientation(LANDSCAPE);
  PFont font = createFont("SansSerif", 100 * displayDensity); 
  textFont(font);
  fullScreen();
}

void draw(){
  frame = (frame+1) % numFrames;
  image(images[frame], 400, 200);
  background(0);
  text(+t+":"+mt+":"+j+"\n "+h+":"+m+":"+s, 330, 300);
}

```

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [December 31, 2020, 11:46pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/2 "2020-12-31T23:46:39Z")

</div>

you loaded 17 images. set numFrames to 17 and it should work.

Arrays start at 0 array[10] only accepts 0,1,2,3,4,5,6,7,8,9 (10 inputs). If you enter array[10] it will return out of bounds

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [January 1, 2021, 2:36am UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/3 "2021-01-01T02:36:47Z")

</div>

Hi @Rogo and @CodeMasterX Happy New Year! 🎆  
@Rogo Since your image names have a pattern. You can load them in a for loop. Like:

```auto
PImage[] images = new PImage[17]; 

 for (int i = 1; i < 18; i++) { 
    String image_name = str(i)+".gif"; 
    images[i-1] = loadImage(image_name);
  }

```

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [January 1, 2021, 11:11am UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/4 "2021-01-01T11:11:40Z")

</div>

sorry my head is not fully conscious because of New Year’s Eve can you explain to me better what to do? or put it in the code for me 😂

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [January 1, 2021, 11:15am UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/5 "2021-01-01T11:15:21Z")

</div>

> [@Rogo](#):
>
> sorry my head is not fully conscious  
> put it in the code for me

It sure isn’t, because I already did. 😂

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [January 1, 2021, 11:44am UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/6 "2021-01-01T11:44:01Z")

</div>

Change the first lines in your code to  
`int numFrames = 17;`  
since you have 17 images to load

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [January 1, 2021, 12:31pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/7 "2021-01-01T12:31:01Z")

</div>

I found my problem sorry I haven’t quite arrived yet​:joy:😂🎉 Happy New Year

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [January 1, 2021, 12:37pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/8 "2021-01-01T12:37:47Z")

</div>

Error:  
Could not load the image because the bitmap was empty.  
Nothing to do with your first error.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [January 1, 2021, 12:39pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/9 "2021-01-01T12:39:28Z")

</div>

Maybe [this](https://www.singlecare.com/blog/best-hangover-cures-that-work/) helps?

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [January 1, 2021, 12:57pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/10 "2021-01-01T12:57:15Z")

</div>

```auto
int numFrames = 16; // The number of frames in the animation
int frame = 15;
PImage[] images = new PImage[16];
int j= year();
int mt= month();
int t= day();
int s= second();
int m= minute();
int h= hour();

void setup(){
  orientation(LANDSCAPE);
  PFont font = createFont("SansSerif", 100 * displayDensity); 
  textFont(font);
  fullScreen();
  frameRate(30);
  images[0] = loadImage("1.gif");
  images[1] = loadImage("2.gif");
  images[2] = loadImage("3.gif");
  images[3] = loadImage("4.gif");
  images[4] = loadImage("5.gif");
  images[5] = loadImage("6.gif");
  images[6] = loadImage("7.gif");
  images[7] = loadImage("8.gif");
  images[8] = loadImage("9.gif");
  images[9] = loadImage("10.gif");
  images[10] = loadImage("11.gif");
  images[11] = loadImage("12.gif");
  images[12] = loadImage("13.gif");
  images[13] = loadImage("14.gif");
  images[14] = loadImage("15.gif");
  images[15] = loadImage("16.gif");
}

void draw(){
  for (int i = 1; i < 17; i++) { 
    String image_name = str(i)+".gif"; 
    images[i-1] = loadImage(image_name);
  }
  background(0);
  images[frame].resize(displayWidth, displayHeight);
  image(images[frame], 50, 50);
  text(+t+":"+mt+":"+j+"\n"+h+":"+m+":"+s, 330, 300);
}

```

In viewing mode and in the app as APK, the gif is not played, “1.gif” is displayed and the date / time no longer changes

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [January 1, 2021, 1:03pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/11 "2021-01-01T13:03:50Z")

</div>

Slow down, take your remedy, and rest a little bit. Your loading too much.

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [January 1, 2021, 1:27pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/12 "2021-01-01T13:27:43Z")

</div>

then can you help me later?

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [January 1, 2021, 2:13pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/13 "2021-01-01T14:13:54Z")

</div>

Hello,

@noel provided a nice example for you to work with [there](https://discourse.processing.org/t/can-everyone-help-me/26661/2).

You are loading 17 images _once_ in [setup()](https://processing.org/reference/setup_.html)

You are then loading 17 images _30 times per second_ in [draw()](https://processing.org/reference/draw_.html)

Puts some comments in your code (twice):  
//Loading 17 images into array

Commenting will help in the long run and help you debug your code.

Hopefully you will have an [epiphany](https://dictionary.cambridge.org/dictionary/english/epiphany)…

And the rest needs some work.

Use the same loop (with changes and modifications) for displaying the images.

References:

> **[for / Reference](https://processing.org/reference/for.html)**
>
> Controls a sequence of repetitions. A basic for structure has three parts: init, test, and update. Each part must be separated by a semicolon (;). The loop continues until …

[![](https://img.youtube.com/vi/h4ApLHe8tbk/maxresdefault.jpg "6.3: For Loop - Processing Tutorial") ](https://www.youtube.com/watch?v=h4ApLHe8tbk)

`:)`

---

<div class="post-metadata">

**Author:** ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Post date:** [January 1, 2021, 3:37pm UTC](https://discourse.processing.org/t/can-everyone-help-me/26661/14 "2021-01-01T15:37:47Z")

</div>

> [@noel](#):
>
> Happy New Year!

happy new year to you to!
