Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make animated GIFs work from Android WebView

Animated GIF images rendered by Android's WebView do not seem to animate. Has anyone figured out how to make them work? I'm testing on an N1 with 2.1-u1. None of the web settings available seem applicable.

like image 984
John in MD Avatar asked Apr 24 '10 01:04

John in MD


People also ask

Why are my GIFs not working on android?

Android devices have not had built-in animated GIF support, which causes GIFs to load slower on some Android phones than on other OS.

Can we use GIF as splash screen?

Android: Sure, add your individual splash screen graphics. Just replace the included splash. gif files with your own image file. Make sure to use GIF format (animated or static).

Does Picasso support GIF?

Picasso does not support GIF animation on a simple image view. Glide loads images faster than Picasso.


3 Answers

Not supported YET. Read more about this here: http://code.google.com/p/android/issues/detail?id=3422

For large memory phones like Droid and Nexus One, the two-line change has been made in Froyo (unreleased) to enable animated GIFs. For small memory phones, the change is not trivial and did not make it into this future release.

like image 55
vladikoff Avatar answered Oct 14 '22 10:10

vladikoff


As a workaround, if you are using a custom WebView, you can do these 2 things together:

  • Enable Javascript for the Webview (Eg: https://github.com/LatinSuD/slidetypekeyboard/blob/master/src/com/latinsud/android/slidetypekeyboard/HelpActivity.java) Like: myWebView.getSettings().setJavaScriptEnabled(true);

  • Then use javascript to swap images (Eg: https://github.com/LatinSuD/slidetypekeyboard/blob/master/assets/index.html)

Please note that this is not a solution for displaying GIFs, you must modify the content of the web, and convert/split GIF animations into different files (one for each frame) in any format (JPG, PNG, etc).

like image 5
LatinSuD Avatar answered Oct 14 '22 09:10

LatinSuD


AFAIK, animated GIFs are not supported on Android except as movie clips played by MediaPlayer.

like image 3
CommonsWare Avatar answered Oct 14 '22 10:10

CommonsWare