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);
}
}
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'
}