I'm having difficulties loading an animated GIF via android.renderscript.Allocation. Here's the defective code:
Bitmap out = Bitmap.createBitmap(src.getWidth(), src.getHeight(), Bitmap.Config.ARGB_8888);
mInAllocation = Allocation.createFromBitmap(mRS, src,
Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
It works fine on my Nexus 4 running Android 4.2 – but fails on my Optimus G running Android 4.1. The exception thrown is:
E/AndroidRuntime(8398): Caused by: android.renderscript.RSInvalidStateException: Bad bitmap type: null
That's being thrown from Allocation.typeFromBitmap because src.getConfig returns null; even though I specifically create it with the following code:
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
bitmapOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap photo = BitmapFactory.decodeByteArray(data, 0, data.length, bitmapOptions);