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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:39:34+00:00 2026-06-01T08:39:34+00:00

I get this error all the time. And as I can see, there are

  • 0

I get this error all the time. And as I can see, there are a lot of questions already on stackoverflow.com, but sadly, I don’t find any answers which will suit me.

I have 60 PNG images (2,5MB all together) which I would like to put it in animation.

I tried with three different ways.

1

mAnimation = new AnimationDrawable();
mAnimation.addFrame((BitmapDrawable)getResources().getDrawable(R.drawable.yawning_00001), FPS_12);  
...
mAnimation.addFrame((BitmapDrawable)getResources().getDrawable(R.drawable.yawning_00063), FPS_12);
mAnimation.start();

2

XML

<animation-list android:oneshot="true">
    <item android:drawable="@drawable/yawning_00001" android:duration="83" />
    ...
    <item android:drawable="@drawable/yawning_00063" android:duration="83" />
 </animation-list>

Java

ImageView img = (ImageView)findViewById(R.id.animation);
img.setBackgroundResource(R.drawable.yawning);
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
frameAnimation.start();

3

With class extending ImageView (I will just show important stuff here)

public void loadAnimation(String prefix, int nframes) {
    mBitmapList.clear();
    for (int x = 0; x < nframes; x++) {
        String zeros = "000";
        if (x < 10) {
            zeros += "0";
        }
        String name = prefix + "_" + zeros + x;
        Log.d(TAG, "loading animation frame: " + name);
        int res_id = mContext.getResources().getIdentifier(name, "drawable", mContext.getPackageName());
        d = (BitmapDrawable) mContext.getResources().getDrawable(res_id);
        mBitmapList.add(d.getBitmap());
    }
}

In all cases I get the same error… All some around after 15 picture loads.

E/AndroidRuntime(1591): java.lang.OutOfMemoryError: bitmap size exceeds VM budget

I am begging to wonder if this is frame animations are even possible in Android.

Does anybody maybe have a alternative to frame by frame animation? If yes, please link to any showcase.

  • 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-01T08:39:36+00:00Added an answer on June 1, 2026 at 8:39 am

    You will need to recycle your images in some way because you won’t have enough memory ever for 60 images.

    You think your images are 2,5 meg all together but this the compressed png version of your files.

    If you want to know how much memory you are using with your files when uncompressed in bitmap format in memory just do : width*height*number of images*bytes per pixel….Then you’ll know why you crash 😀

    AnimationDrawable are not meant for that kind of heavy usage. You should start looking at SurfaceViews and then you’ll be free to implement whatever memory management method you want to use to display your animation.

    http://developer.android.com/reference/android/view/SurfaceView.html

    Good luck.

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

Sidebar

Related Questions

This is a really nebulous error that I can't seem to get a lot
I get this 'error' when running PEVerify on a custom generated assembly. [MD](0x8013124C): Error:
I get this error when trying ruby script/console Rails requires RubyGems >= . Please
I get this error message in Eclipse: Access restriction: The type DirectoryWalker is not
I get this error when I run a django app ( dpaste ) Template
I get this error when I try to use time_ago_in_words : Comparison of String
I get this error when trying to link a win32 exe project. I have
I get this error when launching my Mongrel server... $ script/server --debugger => Booting
I get this error when compiling a C# application. Looks like a trivial error,
I get this error when trying to load a Zend Framework application: Fatal error:

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.