0

i want to display a gif image from server to image view . my image is animation(gif) just animation(gif image)

my code is :

    ImageViewimgView =(ImageView)findViewById(R.id.image01);
    Drawable drawable = LoadImageFromWebOperations("http://www.dariran.com/Ads/Mobile/1.gif");
    imgView.setBackgroundDrawable(drawable);



    private Drawable LoadImageFromWebOperations(String url) {
     try {
        InputStream is = (InputStream) new URL(url).getContent();
        Drawable d = Drawable.createFromStream(is, "src name");
        return d;
        }
    catch (Exception e) {
        System.out.println("Exc="+e);
        return null;
      }
    }
user3404171
  • 103
  • 4
  • 14
  • 1
    Refer here : http://stackoverflow.com/questions/9494413/play-downloaded-gif-image-in-android and here : http://stackoverflow.com/questions/6533942/adding-gif-image-in-an-imageview-in-android – WannaBeGeek Dec 12 '14 at 06:01

1 Answers1

0

The easiest way to play gif is WebView. See this: https://stackoverflow.com/a/12839918/3864698

Actually you can play in CustomView too.

Community
  • 1
  • 1
QArea
  • 4,955
  • 1
  • 12
  • 22