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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:27:41+00:00 2026-06-11T15:27:41+00:00

I need to make several frame-by-frame animation, each containing up to 150 full screen,

  • 0

I need to make several frame-by-frame animation, each containing up to 150 full screen, 480×800, frames, compressed JPEGs.

AnimationDrawable hangs itself with vm budget exceeded after first 10 frames or so.

SurfaceView with new bitmaps loading on timer gives a pretty slow framerate, probably less than 5 fps.

Since I’m new to OpenGL, I wanted to ask if its the right way to go in my situation?

Thanks! 🙂

edit:

loading jpges by

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    BitmapFactory.decodeResource(getResources(), R.drawable.y1).compress(Bitmap.CompressFormat.JPEG, 80, stream);
    byeArr.add( stream.toByteArray() );

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    BitmapFactory.decodeResource(getResources(), R.drawable.y2).compress(Bitmap.CompressFormat.JPEG, 80, stream);
    byeArr.add( stream.toByteArray() );

... and so on.

and playing by

@Override
public void onTick(long millisUntilFinished) {

    if ( i < byeArr.size() )
    {
    bitMap = BitmapFactory.decodeByteArray ( byeArr.get(i) , 0,  byeArr.get(i).length );
    }

yet loading 25 frames takes about 3-5 second. Maybe there’s a way to speed that up? Also is there a way to see how much free memory I have, i.e. how much frames can I load?

Thanks


edit2:
experimentally found that it can keep about 350 frames in an array, which is very good for about 2 full animations. now I just need to find a way to somehow store this pictures as bytes, to be able to load them in almost real time, since decodeResource is kinda slow.

edit3: in edit 2 I made sure that I can store about 350 frames in an array, which is quite enough for one animation.

Therefor I can load frames needed for a current animation into a byte array and play the animation.

Yet the problem is that loading frames by

ByteArrayOutputStream stream = new ByteArrayOutputStream();
BitmapFactory.decodeResource(getResources(), R.drawable.y1).compress(Bitmap.CompressFormat.JPEG, 80, stream);
byeArr.add( stream.toByteArray() );

takes too long. So I need to find a way to speed that up. Supposedly I need to store jpegs already as byte arrays in res or assets, what do you think?

  • 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-11T15:27:42+00:00Added an answer on June 11, 2026 at 3:27 pm

    Start with convert your animation to a video stream then use MediaMetadataRetriever.getFrameAtTime to get the frames. If getting right frames turns to be a problem, you might need to use a library like ffmpeg, look here.

    Another solution – if your total allocation size of jpeg set is small enough – might be to keep jpegs in memory as byte arrays and decode them through BitmapFactory.decodeByteArray whenever you need it. This will help you with 1) vm budget 2) slow disk access.

    You can use the method below to get the raw data from a resource.

    byte[] getBytesFromResource(final int res) {
        byte[] buffer = null;
        InputStream input = null;
    
        try {
            input = getResources().openRawResource(res);
            buffer = new byte[input.available()];
            if (input.read(buffer, 0, buffer.length) != buffer.length) {
                buffer = null;
            }
        } catch (IOException e) {
            buffer = null;
        } finally {
            if (input != null) {
                try {
                    input.close();
                } catch (IOException e) {}
            }
        }
    
        return buffer;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

within the frame of a python application, I need to make calls to several
I have several entities I need to make IEquatable(Of TEntity) respectively. I want them
I need to make a css background image fade slideshow. For several reasons, i
My company has several web applications written in ASP.NET. We need to make these
I have a circumstance where I need to make several getJSON calls, and once
I need to make connections between several tables. And I need to decide whether
I need to make several queries to MySql database. My question is the following:
I need to make one function in a module platform-independent by offering several implementations,
Here's my scenario: I have a page containing several links; each link is meant
I need to make a calendar in which the user can scroll between several

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.