0

My problem is simple - I have one class that extends SurfaceView. I already made some rendering code and tested it. I render on SurfaceView in another thread using holder.lockCanvas(null) surrounded by try{...rendering code...}finally{if(canvas!=null)holder.unlockCanvasAndPost();}

But when I connected the camera I saw tons of "exception locking canvas" messages. It seems that camera locks SurfaceView when preview started, and unlocks when it stopped.

This is my problem, please help

Mk Km
  • 94
  • 6
  • create an overlay view on top of your preview and draw there – pskink Aug 30 '16 at 05:37
  • @pskink I have `SurfaceView` as an activity content view and If it possible to render on the same `SurfaceView` as the camera - it will improve the performance – Mk Km Aug 30 '16 at 05:46
  • http://stackoverflow.com/a/2934759/2252830 – pskink Aug 30 '16 at 05:50
  • @pskink So, you telling me that it is not possible ? – Mk Km Aug 30 '16 at 11:43
  • did you try the same with a TextureView? – pskink Aug 30 '16 at 12:00
  • No, actually, I dont even know what it is. Go to google this now, thanks. – Mk Km Sep 28 '16 at 12:17
  • 1
    Opened android developer site, texture view class `It is important to note that only one producer can use the TextureView. For instance, if you use a TextureView to display the camera preview, you cannot use lockCanvas() to draw onto the TextureView at the same time.` Sad. – Mk Km Sep 28 '16 at 12:22

0 Answers0