0

I am beginning the development of an app that accesses camera video data on an Android tablet. Currently, I am trying to display the preview from the camera in a SurfaceView. The SurfaceView displays the preview when I first run the app, but as soon as I rotate the device, the SurfaceView disappears. However, the data is still being collected as the camera is still receiving information -- just not displaying it.

Is there a way to fix the SurfaceView properties such that it will continue to preview the camera even after the device is rotated?

anjren
  • 1
  • I had exactly the same issue. This answer: http://stackoverflow.com/a/8320717/2012659 fixed it for me! – eculeus Mar 18 '13 at 19:01

2 Answers2

0

try this

public void onConfigurationChanged(Configuration newConfig) { 
        // ignore orientation/keyboard change 
        super.onConfigurationChanged(newConfig);
        } 
user1203673
  • 1,015
  • 7
  • 15
0

Set screenOrientation to potrait in manifest deeclaration of ur activity in which u r showing surfaceview, it will avoid the prob..

This is the way I dealt with the same prob. It can be a good work around.

AAnkit
  • 27,299
  • 12
  • 60
  • 71