I would like to develop an Android application which has the technique of capturing a photo from camera(both front and back) at simultaneously.I searched over internet but unfortunately I couldn't find any better solution.
note for example if I capture the photo from back camera,once it captured from back means then it has to start front camera automatically for capture a photo.
You need to approach this problem step by step.
First build functionality to take picture by back camera.
Once you have done that, then build functionality to take picture by front camera (most of the code will be the same, just setting the back/font camera will be different.
Once you have these two options built, separately, then you can combine the two by making it a three-step process: 1) take picture by back camera 2) switch the camera to front 3) take picture by front camera.
Again, as mentioned, taking picture by back and front cameras are not different, it only involves switching the cameras.
Edited after seeing new comment:
If you are using the built-in camera, that is using intents, then this task is not going to be an automatic and immediate thing. I thought you were building custom camera, where you can do all this by code (without intents and built-in camera). But anyways, you can still do it.
So now, the process will be:
Use intent to go to Camera.
Take a picture (which is by default back camera). Do whatever you
want to do with this picture, save, process, etc.
Use another intent to go to Camera again. This time, add an extra to your intent to so the camera defaults to front camera intent.putExtra("android.intent.extras.CAMERA_FACING", 1);
Take picture again.
Refer to this thread for how to launch front camera with intent:
How to launch front camera with intent?
Related
I'm using an AVD on Android Studio. The app I'm using performs verification, first taking a photo with the back camera, and then switching to the front camera to take a selfie. But the problem I'm having is that I can't seem to use both cameras. Whichever one I don't assign "webcam0" shows a black screen. To get the front facing camera to work for the selfie, I need to assign "webcam0" and either "emulate" or "virtualscreen" to the back. But then the back camera doesn't work.
How do I get both to work? I really need to be able to take a photo with the front and back camera. Thanks in advance for your help!
I want to develop camera functionality for my app where I have to capture 10 images. The camera should not close, rather it should continuously take pictures while I hold the shutter button. I am using intent for opening the camera, but after taking one image the camera is stopping. How can I achieve the desired functionality?
You would need to write your own camera code, using android.hardware.Camera and/or the android.hardware.camera2.* classes. There is no Intent structure that camera app developers are required to support that handles your use case.
In my application, i want to take picture using built-in camera application. Taking picture process is working fine. I want to know is picture taken from front camera or back camera, because after taking picture i want to get the rotation angle and rotate the picture to that angle and store it in sdcard. ExifInterface always return the same angle(90) rather user take the picture from front/back camera. When user take the picture from back camera, rotation is fine but when user take the picture from front camera, picture rotation is wrong. Please suggest any solution for this problem.
Thanks
I believe that your device does something wrong with the rotation flag. You should try other devices, too.
Note that MediaStore.ACTION_IMAGE_CAPTURE may be fulfilled by different Camera apps on different devices, or even on the same device: the end user is free to choose. Some downloaded applications will respect an extra to choose the front camera (see https://stackoverflow.com/a/11159760/192373), other won't. Some will do a better job to provide correct EXIF, others will mess it up.
In my app, I'm using the built-in camera app to take pictures.
The thing is that this interface has a button to change camera ( to front) and when I take a picture with front picture, it is not working anymore.
So, Is there a way to take picture fromt front camera with built-in camera app.
If it is not posible, is there a way to remove the icon from built in app???
Any suggestion will be appreciated!
I am using android.provider.MediaStore.ACTION_IMAGE_CAPTURE to capture images, however on pressing Ok button the camera activity is closed and I received the result in onActivityResult. Is there a way the image capture activity can be kept running after pressing OK button.
At the moment I am starting it again through my onActivityResult function, is it possible that I can keep the same image capture activity running after a successful image capture.
I don't think this is possible with the ACTION_IMAGE_CAPTURE intent. Instead you will have to control the camera preview in SurfaceHolder. Here is one example I have found - How to Program the Google Android Camera to Take Pictures.