0

I would like to show to download the gif file.

And processed using the GifAnimationDrawable.

It was operating in the emulation. Not on other devices. gif images that did not play.

No difficult point to error.

public void showGifView(InputStream input){
                final GifAnimationDrawable drawable;
                try {
                    drawable = new GifAnimationDrawable(input, true);


                    act.runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            // TODO Auto-generated method stub


                            view.setBackground(drawable);
                            AnimationDrawable frameAnimation = (AnimationDrawable) view.getBackground();
                            frameAnimation.start();

                        //view.setImageDrawable(drawable);//drawable.start();

                        }
                    });



                    input.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                    System.out.println("showGifView  //// " +  e);
                }

            }

2 Answers2

0

Why don't you use Glide to display?

String filePath = "/storage/emulated/0/Pictures/amin1.gif";

Glide  
    .with( context )
    .load( Uri.fromFile( new File( filePath ) ) )
    .into( imageViewGif );
mdtuyen
  • 4,470
  • 5
  • 28
  • 50
0

You can also use Glide by bumptech because they also support loading gif images.
You can use it just like this

Glide.with(this)
        .load(url)
        .into(myImageView);

and to use it add this to your gradle file

dependencies {
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.android.support:support-v4:19.1.0'
}
Niko Adrianus Yuwono
  • 11,012
  • 8
  • 42
  • 64