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

  • Home
  • SEARCH
  • 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 8764899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:08:54+00:00 2026-06-13T16:08:54+00:00

I am working on a project that involves animating an image using a sequence

  • 0

I am working on a project that involves animating an image using a sequence of images that is generated randomly. Here’s code I have right now that is not working (or at least it does not appear to work):

/**
 * Method to display the current sequence
 * TODO make an animation for the screen to use
 */
public void displaySeq() {
    ad = new AnimationDrawable();
    int j = 0;
    for(Integer i : sequence) {
        switch(i)
        {
        case Constants.RED:
            System.out.printf("%d - RED\n", j);
            ad.addFrame(resources.getDrawable(R.drawable.red_circle), 500);
            break;
        case Constants.BLUE:
            System.out.printf("%d - BLUE\n", j);
            ad.addFrame(resources.getDrawable(R.drawable.blue_circle), 500);
            break;
        case Constants.GREEN:
            System.out.printf("%d - GREEN\n", j);
            ad.addFrame(resources.getDrawable(R.drawable.green_circle), 500);
            break;
        case Constants.YELLOW:
            System.out.printf("%d - YELLOW\n", j);
            ad.addFrame(resources.getDrawable(R.drawable.yellow_circle), 500);
            break;
        default:
            System.out.printf("%d - bad color: %d\n", j, i);
            ad.addFrame(resources.getDrawable(R.drawable.black_circle), 500);
        }
        j++;
    }
    // add a black circle to the end of the animation
    ad.addFrame(resources.getDrawable(R.drawable.black_circle), 500);
    System.out.println("Number of frames: " + ad.getNumberOfFrames());
    indicator.setBackground(ad);

    indicator.post(new Starter());

}

class Starter implements Runnable {
    @Override
    public void run() {
        ad.start();

    }

}

When I run the application and this method gets called, I see the printout in LogCat, but the indicator does not get animated. Any ideas what is going wrong?

  • 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-06-13T16:08:56+00:00Added an answer on June 13, 2026 at 4:08 pm

    I actually figured out the problem. It was being caused by an error in my XML file. Basically, when I made the layout.xml file in Eclipse and added the ImageView (indicator), Eclipse set the android:src parameter to the image I had selected. Changing android:src to android:drawable resolved the problem.

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

Sidebar

Related Questions

I'm working on a project that involves some home-made (de-)serialization code, and I have
I'm working on a small project that involves me loading an image into a
I'm working on a project that involves uploading an image to tumblr from Python.
I am working on a project that involves me using a HashSet of a
I am currently working on a project that involves splitting a url. I have
I'm working on an project that involves an RFID reader. I have written a
I am working on a project that involves painting on images. To delete the
I have to start working on a project that involves making an application with
I'm working on a project that involves a simple web service, and have had
I am currently working on a project that involves many subprojects that all have

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.