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 7019589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:12:11+00:00 2026-05-27T23:12:11+00:00

I am facing a problem in Frame by Frame animation in Android . Actually

  • 0

I am facing a problem in Frame by Frame animation in Android. Actually i am having lots of images as frames, for that i have crated different animation-list files for different animation. On the main screen i am having one background image on which i am having different buttons for different animation. I am done with animation also, but when i click 2nd time on the buttons the animation does not work. Means it is working only once. I don’t why this is happening. Here is some code snippet of my project.

Animation List File:-

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true">
<item android:drawable="@drawable/cat_angry0000" android:duration="50" />
<item android:drawable="@drawable/cat_angry0001" android:duration="50" />
<item android:drawable="@drawable/cat_angry0002" android:duration="50" />
<item android:drawable="@drawable/cat_angry0003" android:duration="50" />
<item android:drawable="@drawable/cat_angry0004" android:duration="50" />
<item android:drawable="@drawable/cat_angry0005" android:duration="50" />
<item android:drawable="@drawable/cat_angry0006" android:duration="50" />
<item android:drawable="@drawable/cat_angry0007" android:duration="50" />
<item android:drawable="@drawable/cat_angry0008" android:duration="50" />
<item android:drawable="@drawable/cat_angry0009" android:duration="50" />
<item android:drawable="@drawable/cat_angry0010" android:duration="50" />
<item android:drawable="@drawable/cat_angry0011" android:duration="50" />
<item android:drawable="@drawable/cat_angry0012" android:duration="50" />
<item android:drawable="@drawable/cat_angry0013" android:duration="50" />
<item android:drawable="@drawable/cat_angry0014" android:duration="50" />
<item android:drawable="@drawable/cat_angry0015" android:duration="50" />
<item android:drawable="@drawable/cat_angry0016" android:duration="50" />
<item android:drawable="@drawable/cat_angry0017" android:duration="50" />
<item android:drawable="@drawable/cat_angry0018" android:duration="50" />
<item android:drawable="@drawable/cat_angry0019" android:duration="50" />
<item android:drawable="@drawable/cat_angry0020" android:duration="50" />
<item android:drawable="@drawable/cat_angry0021" android:duration="50" />
<item android:drawable="@drawable/cat_angry0022" android:duration="50" />
<item android:drawable="@drawable/cat_angry0023" android:duration="50" />
<item android:drawable="@drawable/cat_angry0024" android:duration="50" />
<item android:drawable="@drawable/cat_angry0025" android:duration="50" />
</animation-list>

Code:-

ImageView rocketImage;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.catlayout);

    rocketImage = (ImageView) findViewById(R.id.backgroundCat);
    rocketImage.setImageBitmap(null);
    rocketImage.setBackgroundResource(R.anim.angry_tail_animation);
}

public void headButtonClicked(View v) {
    final AnimationDrawable mailAnimation = (AnimationDrawable) mMailTab.getBackground();
    mMailTab.post(new Runnable() {
    public void run() {
        if ( mailAnimation != null ) mailAnimation.start();
    }
    }); 
}

headButtonClicked is a button placed by me for starting animation. It work only once. If anybody having any idea that how to resolve this problem please kindly help me.

Thanks

  • 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-27T23:12:12+00:00Added an answer on May 27, 2026 at 11:12 pm

    In your animation xml file you have added the attribute android:oneshot="true" which means you are wanting the Animation to be played only once. For playing it again you should make it android:oneshot="false"

    UPDATE:

    If you want to start the Animation everytime you click the button you have to call the animation.stop(); for the previous started Animation if Running. Something like this,

    if (frameAnimation.isRunning()) {
             frameAnimation.stop();
          }
    
          else {
             frameAnimation.stop();
             frameAnimation.start();
          }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm facing a problem that seems to have no straighforward solution. I'm using java.util.Map
I am facing a situation that I have problem understanding... I am writing a
I'm facing a problem while unit testing my forms. The problem is that data
I am facing problem that whenever I turn off security settings in IE8, in
I have facing problem to access xmlrpc. Whenever I tried to access xmlrpc through
I am facing problem with Inner join in Access Database. I have two table
I am facing problem while upgrading an Higher version over Lower version. I have
I am facing problem adding and deleting DataRows from a DataTable that is meant
I am facing some problem with UISlider programming. 1) style: I know we have
Well, I'm facing a new problem atm. I have two elements fixed to the

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.