Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6730845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:27:28+00:00 2026-05-26T10:27:28+00:00

i have a yahtzee (dice game) where a player rolls 5 dice. i use

  • 0

i have a yahtzee (dice game) where a player rolls 5 dice. i use a countdown timer to do a small animation where all of the dice are displayed as a “1” then “2” then “3” then “4” then all of the dice should go to a random number. on the emulator and any phone i test it on, this seems to work correctly 100% of the time however… since i have released my game on the android market i have gotten hundreds of crash reports complaining of this error, and it seems have something to do with this animation. judging from the user messages, it looks like it goes to all “6’s” then gets a force close.

here is the code:

public void animateDize(){
    new CountDownTimer(900,150){ 

        Integer j = 0;

        @Override
        public void onTick(long millisUntilFinished) {
            for(int i = 0; i < 5; i++){
                if(DieSet[i]== 0){                                      // If dice are not clicked, animate them
                    imageButtons[i].setBackgroundResource(imageRes[j]);
                }
            }
            j ++;          
        }
        @Override
        public void onFinish() {

            randomDize();                                               // Set dice to random values
            }
    }.start();
}

Here is the error i am getting back from my crash report. is there perhaps i better way i could be animating this instead?

java.lang.ArrayIndexOutOfBoundsException at
com.surreall.yatzee.yatzee$7.onTick(yatzee.java:649) at
android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:124) at
android.os.Handler.dispatchMessage(Handler.java:99) at
android.os.Looper.loop(Looper.java:123) at
android.app.ActivityThread.main(ActivityThread.java:4627) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:521) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) at
dalvik.system.NativeStart.main(Native Method)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:27:29+00:00Added an answer on May 26, 2026 at 10:27 am

    Based just on the code we see here, it looks like j will become larger and larger until it’s too large to be an index into the array imageRes, at which point you’ll get this exception. If we saw more code, I might have a different interpretation, but based just on this, that seems a likely explanation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a small Yahtzee game and i have run into some regex
I have started out to write a simple console Yahtzee game for practice. I
I'm making a Yahtzee game and I need a way to calculate a small
Have a rather abstract question for you all. I'm looking at getting involved in
Have written all the code in a silverlight class library (dll) and linked this
Have an app that can use tts to read text messages. It can also
Im trying to write a game of Yahtzee as part of an online course
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.