1

I'm trying to display animated GIF using WebView. It works fine on most devices, but still some of them doesn't support animations and a static GIF is displayed.

How can I detect if the device supports animated GIFs in WebView, so I can display appropriate message if it doesn't?

5 Answers 5

1

Yeah, this seams to be a common issue. There are some workarounds posted in the Bug-report, but it seams that it's not an Android Core-feature.

Some company's (like HTC) maybe took care of this themselves, but you can't rely on animated gif's to work.

2
  • I know I can't, that's why I've asked how to check whether they are supported on current device. Oct 10, 2011 at 16:40
  • Well, if the solution provided by @Prios_KR isn't enough, I'm afraid there is no solution. Oct 10, 2011 at 16:52
1

As you can see with this link http://code.google.com/p/android/issues/detail?id=3422. this issue still unresolved for two yrs. But the most of the devices work fine in Gingerbread. So you might check the OS level (starting in level 9) which is works or not

1
  • Thanks, but I'm looking for a reliable way to check whether current device actually supports animated GIFs. A solution that "works most of the time" isn't enough. Oct 10, 2011 at 16:41
1

Hate to say it this way, but its the most effective way to find out. Open a GIF image, and if it doesnt play... Its not supported on the device

1
  • Doesn't really help in this case :p
    – keyser
    Oct 27, 2012 at 22:38
0

Animated GIF support was added to Android in version 2.2. If you check the version using Build.VERSION, it should tell you whether the GIFs are working.

2
  • 3
    I've received reports from people using 2.2 that GIFs aren't working. Oct 10, 2011 at 16:41
  • This answer is invalid. There are some Android 2.1 phones with GIF support enabled by manufacturer and there are some Android 2.3 phones with no GIF support at all. Nov 11, 2015 at 13:38
0

In the Android C++ file external/webkit/WebCore/platform/graphics/android/ImageSourceAndroid.cpp there is a function static bool should_use_animated_gif(int width, int height) which returns true if ANDROID_LARGE_MEMORY_DEVICE is defined.

Here, Leon Scroggins (seems to be a Google engineer) says that ANDROID_LARGE_MEMORY_DEVICE is defined "for all arm devices with a VFP, and all non-arm devices."

Edit: This is confirmed by external/webkit/Android.mk:

ifeq ($(ARCH_ARM_HAVE_VFP),true)
LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
endif

In my understanding, all ArmV7 cpus do have a VFP, so animated GIFs should work on modern cpus with ArmV7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.