I need to load ~150 JPEG images into ArrayList for playing an animation.
If I load them like that
ByteArrayOutputStream stream = new ByteArrayOutputStream();
BitmapFactory.decodeResource(getResources(), R.drawable.y1).compress(Bitmap.CompressFormat.JPEG, 80, stream);
byeArr.add( stream.toByteArray() );
it can take up to ~10 seconds for 150 images, so maybe there is a way to speed it up? Can I somehow store this images in resources or in assets already as byte[] or something?
Thanks
You can use the method below to get the raw data from a resource. You don’t need to decode then compress again.