VideoView getDrawingCache is returning black

From the docs for View#setDrawingCacheEnabled:

Enabling the drawing cache is similar
to setting a layer when hardware
acceleration is turned off. When
hardware acceleration is turned on,
enabling the drawing cache has no
effect on rendering because the system
uses a different mechanism for
acceleration which ignores the flag.
If you want to use a Bitmap for the
view, even when hardware acceleration
is enabled, see setLayerType(int,
android.graphics.Paint) for
information on how to enable software
and hardware layers.

It’s possible that the VideoView operates with hardware acceleration and is bypassing the caching mechanism. A good source dive might shed some light.

Editthis post seems to clear some things up:

Sorry, by its nature a SurfaceView does
not draw in the normal view hierarchy
update system, so it won’t be drawn in
that.

(VideoView is a child of SurfaceView)

Leave a Comment