Before Android 2.3, there was no API for accessing a front camera, and all device cameras were rear cameras. The API call you are using is the original one, and will still only open a rear-facing camera, for compatibility. On the Nexus 7 you will get null
.
You need Camera.open(int)
to choose another camera. On the Nexus 7 since there is just one camera, it will definitely be opened with Camera.open(0)
. But really you need to interrogate all available cameras and pick the one you want.
The source code from zxing / Barcode Scanner shows how it opens a rear camera, unless none is available, in which case a front camera is opened.
(Note that Barcode Scanner+ will let you choose between them too, if you have it.)