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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:02:51+00:00 2026-05-23T13:02:51+00:00

I have tried every sample of code I can find that defines and runs

  • 0

I have tried every sample of code I can find that defines and runs a frame animation, but the ImageView never changes. The original Image in the ImageView stays.

EDIT:
After many days of trial and error, I ran the APK on my phone instead of the emulator.
It works on my phone, but for some reason it does not on the emulator.

  • 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-23T13:02:51+00:00Added an answer on May 23, 2026 at 1:02 pm

    I am not exactly clear why you can’t start animations from the onCreate thread, they need to be posted to whatever thread the handler of the view was created on.

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final ImageView view = (ImageView) findViewById(R.id.shell);
        view.setVisibility(ImageView.VISIBLE);
        view.setBackgroundResource(R.drawable.animation_frame);
    
        view.post(new Runnable(){
    
          public void run(){
            AnimationDrawable frameAnimation =  (AnimationDrawable) view.getBackground();
            frameAnimation.start();
          }
        });
       }
    }
    

    I have no idea why you need to do this but you do.

    edit:Here is snippets from my working project should be everything you need…

    in java in onCreate:

    final ImageView image1 =  (ImageView) v.findViewById(R.id.coin1);
    image1.post(new Runnable() {
    
            @Override
            public void run() {
                AnimationDrawable ani = (AnimationDrawable) image1.getBackground();
                ani.start();
            }
        });
    

    in xml layout:

            <ImageView android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/coin"
            android:id="@+id/coin1"/>
    

    coin xml:

    <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
        <item android:drawable="@drawable/coin_spin_a" android:duration="100"/>
        <item android:drawable="@drawable/coin_spin_b" android:duration="100"/>
        <item android:drawable="@drawable/coin_spin_c" android:duration="100"/>
        <item android:drawable="@drawable/coin_spin_d" android:duration="100"/>
        <item android:drawable="@drawable/coin_spin_e" android:duration="100"/>
        <item android:drawable="@drawable/coin_spin_f" android:duration="100"/>
    </animation-list>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried every way I can think of with this, but just not
I have tried every install method I can think of to install RPy2 on
I have tried making every div 75px and the table within the div but
I have looked on here and tried every answer available, but it is still
Have tried to find solutions for this and can't really come up with anything.
So I have tried to find a answer but must not be searching correctly
I have searched and tried every example regarding singleton, public, and global variables in
Hi i want to apply style on every 2nd <li> i have tried <script>
Can't find a simple solution to this, I know it's easy and I've tried
I have used the NameAndPassword Auth Plugin sample code from Apple to create my

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.