--- layout: page title: "Previews" subtitle: "Camera preview implementations" category: docs order: 6 date: 2018-12-20 21:58:16 disqus: 1 --- CameraView supports different types of previews, configurable either through the `cameraPreview` XML attribute or programmatically with the `Preview` control class. This defaults to the new `GL_SURFACE` and it is highly recommended that you do not change this to use all the features available. However, experienced user might prefer a different solution. ### Options |Preview|Backed by|Info| |-------|---------|----| |`Preview.SURFACE`|A `SurfaceView`|This might be better for battery, but will not work well (AFAIR) with dynamic layout changes and similar things. No support for video snapshots.| |`Preview.TEXTURE`|A `TextureView`|Better. Requires hardware acceleration. No support for video snapshots.| |`Preview.GL_SURFACE`|A `GLSurfaceView`|Supports video snapshots. Might support GL real time filters in the future.| The GL surface, as an extra benefit, has a much more efficient way of capturing picture snapshots, that avoids OOM errors, rotating the image on the fly, reading EXIF, and other horrible things belonging to v1. These picture snapshots will also work while taking videos. ### XML Attributes ```xml ``` ### Related APIs The preview method should only be called once and if the `CameraView` was never added to a window, for example if you just created it programmatically. Otherwise, it has no effect. |Method|Description| |------|-----------| |`setPreview(Preview)`|Sets the preview implementation.|