Key words:android decode WEBP sample
When I knock down the keyboard when there is a deep sense of shame, see the Android 4.0 support WEBP format image, so I am looking for the provision of what kind of api,nnd, obstinately did not find, then hold a try mentality, with bitmapfactory to read, the result is not a problem. Come to a conclusion, as a code farmers, to dare to try to dare to do!
WEBP decoding
It's no different from your decoding jpg, it's in the drawable or somewhere, and then
Bitmap bmp = Bitmapfactory.decoderesource (Getresources (), R.RAW.WEBP);
Imv.setimagebitmap (BMP);
So, it's on top of the ImageView. Of course, this approach is only feasible in 4.0. If you want to be compatible with the old version (Android devices under 4.0), then you need to use the Jni method. Here gives the StackOverflow the above method, need to try, with JNI package, also not much trouble. Here is not done, give a link, need to be able to get down.
Http://stackoverflow.com/questions/7032695/webp-for-android
WEBP Code:
Coding is no different than your bitmap code, ICS Bitmap.compressformat This enumeration has WEBP, so support encoding into this format. Have Fun,good luck!
The above on the Android WEBP codec data collation, follow-up continue to supplement the relevant information, thank you for your support of this site!