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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:11:35+00:00 2026-05-16T03:11:35+00:00

When I try to code a frame-by-frame animation in Eclipse, It gives me a

  • 0

When I try to code a frame-by-frame animation in Eclipse, It gives me a bug. I found something on the internet that says they screwed up in the sdk tutorial documentation but I cannot help but wonder what android:id=”selected” means or what should be put in the quotations instead.

Also, can somebody explain the last part of the frame animation tutorial to me?
http://developer.android.com/guide/topics/resources/animation-resource.html#Frame
Do you put another code in the filename.Java, and if so, where do you put it?
I cannot understand where to put the second code that is not XML. I think I need to know what the code below is and where it should go:

ImageView fileimage = (ImageView) findViewById(R.id.file_image);
fileimage.setBackgroundResource(R.drawable.file_image2);

fileAnimation = (AnimationDrawable)fileimage.getBackground();
fileAnimation.start();

But here is the XML code I used:

 <animation-list android:id="selected" android:oneshot="false">
 <item android:drawable="@drawable/filename" android:duration="200" />
 <item android:drawable="@drawable/filename2" android:duration="200" />
 </animation-list>

Should anything be removed or added from that? I don’t know what else to do, because I need to start the animation and have the code for that (1st one) but I don’t know where it goes, or if I need another code along with it.

  • 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-16T03:11:36+00:00Added an answer on May 16, 2026 at 3:11 am

    This is how I implemented it.

    In your main java file you should have something like this.

    public class Main extends Activity { 
    AnimationDrawable mainanimation;
    
    public void onCreate(Bundle icicle) { 
         super.onCreate(icicle); 
         setContentView(R.layout.main);
    
         ImageView mainimage = (ImageView) findViewById(R.id.MainAnim);
         mainimage.setBackgroundResource(R.anim.mainanim);
         mainanimation = (AnimationDrawable) mainimage.getBackground();
    

    So you set the ImageView in your main.xml layout file to the xml that contains the animation (R.id.MainAnim)

    Then in your MainAnim.xml (located in res/anim) file you write

    <?xml version="1.0" encoding="utf-8"?>
    <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
    <item android:drawable="@drawable/image1" android:duration="2000" />
    <item android:drawable="@drawable/image2" android:duration="2000" />
    </animation-list>
    

    Now image1 and image2 will alternate back and forth at 2 seconds each. Also I didn’t use andriod:id=”selectable”.

    To recap you need 3 files. Your Main.java, your main.xml layout file, and your mainanim.xml file located in res/anim. Also your 2 images in the drawable folder.

    Hope that clears it up a little.

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

Sidebar

Ask A Question

Stats

  • Questions 522k
  • Answers 522k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You should use call dgemm_ and dposv_ using the type… May 16, 2026 at 9:27 pm
  • Editorial Team
    Editorial Team added an answer There's not a config parameter for everything! But you can… May 16, 2026 at 9:27 pm
  • Editorial Team
    Editorial Team added an answer You have to call notificationIntent.putExtras(...) before creating PendingIntent that takes… May 16, 2026 at 9:27 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I used the code to try set the label text but its not working.
If I have a code like the following: try { doSomething(); } catch (...)
I am using some code which was originally taken from the Apple sample ViewTransitions
I'm trying to implement a flip animation to be used in board game like
i got this exception when i done the code given below.. Unable to evaluate
I try to post some data via json objects to my asp.net mvc view,
I have a function that I want to use as an event handler: void
i try to undo myContext from save state then after i draw the line
I have the following code in a stand-alone Cocoa test app: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
I've searched for many topics through stackoverflow and found many good solutions. For example,

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.