Is it possible to use front and back Camera at same time in Android [duplicate]

I want to use front and back Camera of device both at same time. In my app, first half of the screen will display preview of back camera and next half of the screen will display front camera preview.

I have tried this with setting two different camera previews but when I open my app, first half of the screen(which displays back camera preview) does not display the preview. And second half of the screen(which displays front facing Camera) displays back facing Camera(strange).

According to Camera.open(int) documentation:

Your application should only have one Camera object active at a time for a particular hardware camera.

This means if both camera hardware (front and back) are different and can be opened at same time.

In my application, I am using the same above api. This does not give any exception or error when I open and call Camera.startPreview(); for both cameras at same time. But still it is not working. I can see only one camera preview at a time.

Is there anything which I am missing here to use both cameras at same time?


Solution 1:

I got simultaneous dual camera access working on the HTC ONE M8

Video: http://youtu.be/lt8N1Lpa9Zw
Feel free to use my code from here: https://bitbucket.org/jens_grubert/androiddualcameracapture/

Solution 2:

Same as a single camera... Just double.

Two SurfaceHolders, and two Camera instances.

http://developer.android.com/reference/android/hardware/Camera.html

https://stackoverflow.com/a/4591023/1602230

http://developer.sprint.com/show_thread.do?forumId=528&threadid=26999&messageId=78914

Using both cameras on android: "Fail to connect to camera service"

Refered from https://stackoverflow.com/a/8411122/1602230