0

I have gone through this recipe and it is working fine. However, I have a couple of questions:

1) It tells me how to work with the main camera but I am looking to work with the front camera, how can I do that?

2) I have to develop an app for 10.1 tablet and I was hoping that when I click on the 'Activate Camera' button, the front camera activates and rather than showing what the camera sees in the complete view, I should be able to show it in a defined box on that screen. In other words, I want to have a screen that has a button and a box in which I need to show what the camera sees. I believe I have seen an app do like this so I am assuming that it is doable.

Any help in these matters will be highly appreciated.

Thanks, Ahmed

Ahmed Salman Tahir
  • 1,783
  • 1
  • 17
  • 26
  • That sample starts the default camera application, which is responsible to handle which camera to use. – Cheesebaron Jun 25 '13 at 15:47
  • Can you please elaborate a bit more? I am a newbie so would need more than that! Thanks. – Ahmed Salman Tahir Jun 26 '13 at 07:31
  • The sample uses `StartActivityForResult(intent, 0)` where the intent is to start the default Camera application. From there on your code has nothing to do with the effects, orientation etc. while taking the picture. It is first when the Canera activity returns you regain control. – Cheesebaron Jun 26 '13 at 15:20
  • Thanks for the explanation. So can you please tell me how can I activate the front camera instead? Any good example that you can share? – Ahmed Salman Tahir Jun 26 '13 at 17:32
  • @Cheesebaron - any further insight buddy? I am still stuck! – Ahmed Salman Tahir Jun 27 '13 at 21:07

2 Answers2

2

Try this sample. Maybe it is possible to setup Camera object somehow to use frontcam.

Ludwo
  • 6,043
  • 4
  • 32
  • 48
0

how to get the front camera :

Camera.CameraInfo camInfo = new Camera.CameraInfo ();
for (int i = 0; i < Camera.NumberOfCameras; i++) {
    Camera.GetCameraInfo (i, camInfo);
    if (camInfo.Facing == CameraFacing.Front){
        try {
            return Camera.Open(i);
        } catch (Exception e) {
            // log or something
        }
    }
}
return null;
Benoit Jadinon
  • 1,082
  • 11
  • 21