Right now, you are using the three-parameter version of decodeByteArray()
. Instead, switch to the four-parameter version, passing in a BitmapFactory.Options
as the last value. On there, set inBitmap
to be a Bitmap
object that can be reused.
This requires you to maintain a small Bitmap
object pool. It could be as simple as two Bitmap
instances: the one that is presently being displayed and the one that you are preparing for the next "frame" of the video.
The catch is that, for API Level 18 and below, the Bitmap
needs to be the same resolution (height and width in pixels). In your case, that's probably not a problem, as I would imagine that each of your bitmaps have the same resolution.