2
webview.loadUrl("http://example.com/image.gif");

loads an animated gif

webview.loadData("<img src='http://example.com/image.gif'/>","text/html", "UTF-8");

loads a static image

webview.loadUrl("http://example.com/gif.html");

loads a page where every gif is not animated.

i've tested this on the emulator and on my galaxy tab 10.1 running 4.0.4. I've seen some apps that load a webview with a page and they have animated gifs soo i must be missing something.

webview.getSettings().setJavaScriptEnabled(true);

doesn't change anything and i've tried http://code.google.com/p/slidetypekeyboard/source/browse/trunk/assets/index.html but it wont animate the gif either

what i'm asking : how to enable gif animation with .loadData() ? To expand, i want

webview.loadData("<center><img src='http://example.com/image.gif'/><center>","text/html", "UTF-8");

to display the animated gif.

Arnas
  • 329
  • 4
  • 16
  • do you mean loadData or loadUrl? you havent mentioned loadData in your post other than in the "what im asking" bit – JustDanyul Dec 07 '12 at 15:30

1 Answers1

1

I had the same problem. This answer helps me. It has a different theme, but main trick is that

"For some reason loadDataWithBaseURL and loadData functions have completely different implementation."

Try this:

webview.loadDataWithBaseURL(null, "<center><img src='http://example.com/image.gif'/><center>", "text/html", "utf-8", null);
Community
  • 1
  • 1
DRS
  • 56
  • 4