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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:56:19+00:00 2026-05-26T23:56:19+00:00

I tried using the following snippet code to decode the animated gif file with

  • 0

I tried using the following snippet code to decode the animated gif file with the Movie class.

            URL url;
            InputStream is = null;
            BufferedInputStream bis = null;
                url = new URL("http://emos.plurk.com/aeddddbbf63e980128ab7b3c1fca2798_w48_h48.gif");
                HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();

                is = httpURLConnection.getInputStream();
                bis = new BufferedInputStream(is);
                byte[] array = streamToBytes(bis);
                mGifMovie = Movie.decodeByteArray(array, 0, array.length);

and draw the Movie in the overrided onDraw method in an extended ImageView like this:

if (mGifMovie != null) {
        long now = android.os.SystemClock.uptimeMillis();
        if (mMovieStart == 0) { // first time
            mMovieStart = now;
        }
        if (mGifMovie != null) {
            int dur = mGifMovie.duration();
            if (dur == 0) {
                dur = 1000;
            }
            int relTime = (int) ((now - mMovieStart) % dur);
            mGifMovie.setTime(relTime);
            mGifMovie.draw(canvas, 0, 0);
            invalidate();
        }
    }

Some animated gif works, but some others like this one are not.
It came out with some frames are failed to be decode.
Here is the screenshot: https://i.stack.imgur.com/le4bC.png (original image: http://emos.plurk.com/aeddddbbf63e980128ab7b3c1fca2798_w48_h48.gif)

I tested with some other apps on the market.
They decode the animated gif successfully.
How should I make it correct?

EDIT:
I would like to decode the animated Gif correctly on my 2.3.x devices like those apps on the market.

  • 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-26T23:56:20+00:00Added an answer on May 26, 2026 at 11:56 pm

    I turned out to use custom gif decoder to run on under 3.0 devices.
    Here is the java sample code: http://www.java2s.com/Code/Java/2D-Graphics-GUI/DecodesaGIFfileintooneormoreframes.htm

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

Sidebar

Related Questions

I tried to modify a type using the following code and it gave me
I'm using the following snippet of code in an MVC Action to return an
One of my fellow developer has a code similar to the following snippet class
I'm trying to generate excel using c# following is the code snippet for it
I have the following code snippet. I am compiling using the sun studio 12
The following code snippet works fine for CSV file sizes larger than 10 K.
I have tried using the obvious method as outlined in the following example but
I tried using "cap rollback" but I get the following error: $ cap rollback
I tried to reuse the .pch to speed the build using the following way:
Has anyone ever tried sending emails using 1&1 smtp host? I tried the following?

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.