10

I want to incorporate a camera feature in my app, that will allow layout transitions of the view itself, changing its size, its preview size, and handle orientation changes efficiently. Should I use TextureView or SurfaceView?

Decisions decisions..

OferM
  • 902
  • 1
  • 8
  • 20
  • 1
    You can find various examples in Grafika (https://github.com/google/grafika), where SurfaceView and TextureView are used for camera preview and video playback. Generally speaking, SurfaceView is more efficient at displaying images, but TextureView is more flexible. For example, compare how the aspect ratio is set for video playback in PlayMovieActivity vs. PlayMovieSurfaceActivity -- the former uses a transformation matrix, the latter requires a custom frame layout. – fadden Dec 01 '14 at 17:04

1 Answers1

12

According to your context I suggest TextureView because things like transformations, animations and scaling is not possible with the SurfaceView. But keep in mind TextureView will consume more memory than SurfaceView.

Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155
Sachini Samarasinghe
  • 1,081
  • 16
  • 18