Can't see live camera on Nexus 7


#1

I’m on the page 315 and can’t see the live camera after pressing the ImageButton to take the picture
However i can see it using this code.

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);

Any ideas how i can do it using your methods?


#2

Since the nexus 7 has only a front facing camera, you’ll need to do a couple of things differently. One, use the android.hardware.camera.front feature in your manifest.

I don’t have a 7 handy to test with, but I believe that since it only has one camera, you are still fine calling camera.open(0). It may be the case that you need to call camera.open(1), though, to select the front facing camera (this is definitely the case on devices with multiple cameras).


#3

I did those changes , and the CrimeCameraFragment surfaceView is still black,i tried camera.open(1) and it crashed, gonna check my code again in case I made some mistake


#4

Have you tried running your code on an emulator with a front-facing camera enabled? Do you get the same result?


#5

it was something on my code i guess,couldn’t find out what exactly even though i checked several times, but it worked with pasting the CrimeCaremraFragment for 19th chapter solution