I want to display animated GIF images in my custom listview.my GIF image is get in
You can use Android Movie class that is able to decode gifs.
Movie.decodeStream(InputStream is);
Use WebView
rather then ImageView and loadUrl
in WebView.
you have to use gif decorder class for that and set it in inflact view so you can set two view in single activity or screen.
//-----------------GIF Image view ------------
holder.imgAdd.getSettings().setJavaScriptEnabled(true);
holder.imgAdd.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
activity.setTitle("Loading...");
activity.setProgress(progress * 100);
if(progress == 100)
activity.setTitle(R.string.app_name);
}
});
holder.imgAdd.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
// Handle the error
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
holder.imgAdd.loadUrl(imgUrl);
Use the Glide image loading library, it has built-in support for GIFs and the syntax is the same loading a JPEG file:
Glide.with(this).load("http://.../anim.gif").into(imageView);
See the wiki for more and run the Gihpy sample to be amazed :)