0

I run into following Problem: I'm currently displaying a CameraPreview on a SurfaceView using its SurfaceHolder as described here Camera Dev Guide. So its mentioned that I have to set the Type of my SurfaceHolder like this;

// deprecated setting, but required on Android versions prior to 3.0
 mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

unfortunatly after that setting mHolder.lockCanvas() will fail,so that I cannot draw anymore on that Canvas. Is there a possibility, to draw PreviewFrames as well as own Views on one single SurfaceView?

If Not, is it possible to render two SurfaceViews, so that the Camera will serve as a background and the second SurfaceView will render any of its Views 'on Top' of it? What is the best approach to get this running?

Simon Sarris
  • 62,212
  • 13
  • 141
  • 171
Rafael T
  • 15,401
  • 15
  • 83
  • 144

1 Answers1

1

Yes i have alredy did this. What you can do is that you can create a relative layout then you can add your surface view to it with proper layout params. then you can add your other view on that same relative layout with proper layout params.

Bharat Sharma
  • 3,926
  • 2
  • 17
  • 29
  • so, it is not possiblbe to render it in ONE Surface View, and I have to take Two SurfaceViews? – Rafael T Apr 27 '12 at 07:38
  • if you are having a single surface view only then it is possible to do it just dont add your second surface view actually you are adding every thing on your relative layout in that technique which i have told to you. – Bharat Sharma Apr 27 '12 at 10:00
  • just now i have fixed some thing in which one glview is at background on complete screen and camera preview is at front at corner of screen with small size and some buttons are there on that. if your case is similar then may be i can help you. – Bharat Sharma Apr 27 '12 at 11:28
  • I now managed to get two SurfaceViews Running inside a FrameLayout: the bottom one serves as cameraPreview Background, while the top one has a transparent Background and renders my CustomViews – Rafael T Apr 27 '12 at 12:19
  • hmm but check properly they are showing on home button press and back press – Bharat Sharma Apr 27 '12 at 12:23