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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:06:52+00:00 2026-06-12T14:06:52+00:00

I would like to do frame-by-frame animation in my android activity. I went through

  • 0

I would like to do frame-by-frame animation in my android activity. I went through the developer guide and found that the start() method has to be called from outside the onCreate() method to get the animation started. I used the similar onTouchEvent() method to start the animation. But the animation is not started. While searching, I found the following post( Starting Frame-By-Frame Animation ) where it has been mentioned that animation could be started from onClick() method(But code was not provided). I am not able to do that. Could someone help me solve this problem?

One more important point I want to add is, I am able to call start() of Mediaplayer object from the onTouchEvent method and not the start() of animation.

I have one more question. I am using emulator 2.3.3. Is animation supported in SDK 2.3.3?

I am posting my code here:

public class firstface extends Activity {
MediaPlayer mp1;
AnimationDrawable anim;

    @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);     

    mp1 = MediaPlayer.create(this, R.raw.red);
    status = ReadStatus();

    ImageView image = (ImageView)findViewById(R.id.image_1); 
    image.setBackgroundResource(R.drawable.anim_1);
    anim = (AnimationDrawable) image.getBackground();

    /*image.setOnClickListener(new View.OnClickListener() { 
    public void onClick(View v) { 
     // TODO Auto-generated method stub 
        mp1.start();            
        anim.start();
        } 
    });*/

    Button but_1_2 = (Button) findViewById(R.id.button_1_2);
    but_1_2.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            to_be_writ = my_face + ":l:" + down + ":d:n"; 
            WriteStatus(to_be_writ);
            intent = "android.intent.action." + right + "FACE";
            startActivity(new Intent(intent));
        }
    });
}

public boolean onTouchEvent(MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            mp1.start();
            anim.start();
            return true;
        }
        return super.onTouchEvent(event);
    }


    @Override
protected void onDestroy() {
    // TODO Auto-generated method stub
    super.onDestroy();
    mp1.release();

}

@Override
protected void onStop() {
    // TODO Auto-generated method stub
    super.onStop();
    mp1.release();

}
  • 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-12T14:06:53+00:00Added an answer on June 12, 2026 at 2:06 pm

    I had the same issue on 2.3.3 when trying to start() the animation from 2.3.3 in the onCreate method. I moved my call to start() to the onWindowFocusChanged(boolean) and it worked (as described here: http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html#start())

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

Sidebar

Related Questions

I'm trying to create an animation that would look like 2 french doors (or
I would like to process a frame element in my source xml file using
I would like to execute a frame redirect in C# from my managed module
I would like to add a column to every data frame in my R
I would like to identify binary columns in a data.frame. For example, this table
I have a data.frame of a time series of data, I would like to
I have the following data test<-data.frame(group=1:10, var.a=rnorm(n=10,mean=500,sd=20), var.b=runif(10)) I would like a barplot with
I have a class that contains decoded video frames. I would like my decoder
Would like a for loop in jquery so that: For every hover_link: show hidden
I'm doing an animation class in ActionScript 3 and would like to know 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.