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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:59:37+00:00 2026-06-14T07:59:37+00:00

I want to play a frame by frame animation. I have a ArrayList byeArr

  • 0

I want to play a frame by frame animation.
I have a ArrayList byeArr that contains jpeg pictures and decodes them one by one to show on a surfaceview.

tim = new CountDownTimer(1,1)
{
int i = 0;

@Override
public void onFinish()
{

    if ( i < byeArr.size() )
    {
        bitMap = BitmapFactory.decodeByteArray ( byeArr.get(i) , 0,  byeArr.get(i).length );
            /// bitMap is a bitmap that is displayed on screen.

        lastFrameMs = System.currentTimeMillis() - lastFrameSysTime;
        totalFr = totalFr + lastFrameMs;
        Log.e("LF", "frame: "+ String.valueOf(i) + " = " + String.valueOf(lastFrameMs) +"ms");

        lastFrameSysTime = System.currentTimeMillis();
        i++;
        tim.start();

    }
...

For example, if I would want to have a 15 FPS frame rare, I should set CountDownTimer to 1000/ 15 – lastFrameMs , where lastFrameMs would be time to draw one frame.

This would work nice, it the frames would be drawn at a constant speed, yet the problem is that they do not. Each frame can take everywhere from 25 to 65 ms…

11-14 19:00:52.402: E/LF(26270): frame: 0 = 60ms
11-14 19:00:52.429: E/LF(26270): frame: 1 = 27ms
11-14 19:00:52.488: E/LF(26270): frame: 2 = 55ms
11-14 19:00:52.519: E/LF(26270): frame: 3 = 32ms
11-14 19:00:52.574: E/LF(26270): frame: 4 = 57ms
11-14 19:00:52.605: E/LF(26270): frame: 5 = 30ms
11-14 19:00:52.664: E/LF(26270): frame: 6 = 56ms
11-14 19:00:52.695: E/LF(26270): frame: 7 = 33ms
11-14 19:00:52.753: E/LF(26270): frame: 8 = 58ms
11-14 19:00:52.824: E/LF(26270): frame: 9 = 71ms
11-14 19:00:52.886: E/LF(26270): frame: 10 = 62ms
11-14 19:00:52.914: E/LF(26270): frame: 11 = 27ms
11-14 19:00:52.976: E/LF(26270): frame: 12 = 62ms
11-14 19:00:53.007: E/LF(26270): frame: 13 = 29ms
11-14 19:00:53.066: E/LF(26270): frame: 14 = 61ms
11-14 19:00:53.097: E/LF(26270): frame: 15 = 27ms
11-14 19:00:53.171: E/LF(26270): frame: 16 = 77ms
11-14 19:00:53.199: E/LF(26270): frame: 17 = 28ms
11-14 19:00:53.261: E/LF(26270): frame: 18 = 62ms
11-14 19:00:53.300: E/LF(26270): frame: 19 = 37ms
11-14 19:00:53.355: E/LF(26270): frame: 20 = 56ms
11-14 19:00:53.390: E/LF(26270): frame: 21 = 34ms
11-14 19:00:53.457: E/LF(26270): frame: 22 = 66ms
11-14 19:00:53.484: E/LF(26270): frame: 23 = 30ms
11-14 19:00:53.550: E/LF(26270): frame: 24 = 64ms
11-14 19:00:53.582: E/LF(26270): frame: 25 = 31ms
11-14 19:00:53.640: E/LF(26270): frame: 26 = 60ms
11-14 19:00:53.667: E/LF(26270): frame: 27 = 29ms
11-14 19:00:53.734: E/LF(26270): frame: 28 = 66ms
11-14 19:00:53.769: E/LF(26270): frame: 29 = 33ms
11-14 19:00:53.828: E/LF(26270): frame: 30 = 60ms
11-14 19:00:53.871: E/LF(26270): frame: 31 = 43ms
11-14 19:00:53.929: E/LF(26270): frame: 32 = 58ms
11-14 19:00:53.933: E/- - -(26270):  - - - 
11-14 19:00:53.933: E/fps(26270): 21 FPS
11-14 19:00:53.933: E/avrg ms for frame(26270): 46

… any ideas what could be done about it?

Thanks!

  • 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-14T07:59:38+00:00Added an answer on June 14, 2026 at 7:59 am

    You should not display them as soon they are decoded.

    In your timer, decode a bitmap then wait a time X before displaying the bitmap. Where X is

    X = constantInterval - lastFrameMs.
    

    if X is negative, then draw immediately.

    Also, you should consider storing your animation in RAM more than decoding it, if it’s small enough.

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

Sidebar

Related Questions

I want to play an animation(Gif) or a movie instead of Default.png. Is that
I want to play one music repeatedly until user presses the toggle button off..
i want to play multiple swf files in a single shockwaveflash object instance one
I want to create a play button that has a play image (triangle) and
I have downloaded Play Framework from GitHub and compiled it. Now I want to
I want to play YouTube videos from my iPhone app. I have to tried
I want to play an animation in my mainView ( Company Logo ) .
I want that the animation starts when the mouse is over the sprite and
I want my MovieClip to play from frame 5 to frame 30 and then
I am working on VLCJ. I want to play a video where every frame's

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.