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

The Archive Base Latest Questions

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

I have been trying to get it to work using this thread but can’t

  • 0

I have been trying to get it to work using this thread but can’t seem to get it to work.

Frame-by-frame animations

I am trying to get the screen to alternate between two layouts and I have tried lots of different things from state list drawables, to shape drawables, and even flipViews(flipViews didn’t work because you cannot change the background, just the foreground).

Right now I am getting a null pointer. If you would like to point out that I can not use a layout in an animation then please do so as it’s probably the problem but I can’t be sure.
Any solution to reach my end goal is appreciated.

My Oncreate contains the following(minus the standard stuff)

ImageView mainimage = (ImageView) findViewById(R.id.main);
     mainimage.setBackgroundResource(R.anim.blink);
     AnimationDrawable blinkAnimation = (AnimationDrawable) mainimage.getBackground();
     blinkAnimation.start();

My Animation file contains this:(minus the utf stuff)

<

animation-list xmlns:android="http://schemas.android.com/apk/res/android"
        android:oneshot="false">
        <item android:drawable="@drawable/royalblue" android:duration="200" />
        <item android:drawable="@drawable/blank" android:duration="200" />
    </animation-list>

The Main in the Image view is just this blank xml file

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

</LinearLayout>

This is the layout I have placed in the drawable folder because I want it to be a frame in the animation.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/blinkBlue"
    android:background="@color/royalBlue"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"

    >

</LinearLayout>

This is the other layout I have placed in the drawable folder because I want it to be a frame in the animation.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/blinkBlack"
        android:background="@color/black"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"

        >

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

    I know that this is quite late response but for the others who are facing the same issue here is my solution:

    AnimationDrawable drawable = (AnimationDrawable)getResources().getDrawable(R.anim.amin_list);
    ImageView im = (ImageView) findViewById(R.id.image);
    im .setBackgroundDrawable(drawable);
    im .post(drawable);
    

    Where amin_list is:

    <animation-list  android:oneshot="false" 
        xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:drawable="@drawable/progress_1" android:duration="150" />
        <item android:drawable="@drawable/progress_2" android:duration="150" />
        <item android:drawable="@drawable/progress_3" android:duration="150" />
        <item android:drawable="@drawable/progress_4" android:duration="150" />
     </animation-list> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have been trying to get this script http://jsbin.com/ipajo5/ working but using .live()
I have been trying everything I can to get this script to work and
This is crazy, I have been trying for hours to get this to work.
I have been trying to get this working for quite a while now but
I have been trying to get a simple xhr request to work but for
I have been trying to get nServiceBus to work with Ninject 2.0 as the
I have had been on a roller coaster trying to get ImageMagick to work
I have been trying to get around this error for a day now and
I have been trying to get LastBootUpTime using Win32_OperatingSystem class (WMI). HRESULT hr =
I have been trying to get this one section of my UI to immediatly

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.