user6839793 user6839793 - 1 year ago 96
Android Question

Android inapp camera and video capture

I am trying to implement an in-app camera to my application, which will allow me to take either a still photo or a video, with the result being stored in a variable. I drew a rough idea of how I want it to look here

So basically the top tabs (HOME, GALLERY, CAMERA, EFFECTS) are all fragments. Assuming we are currently on the "CAMERA" tab, inside this view you will have two further tabs at the bottom one for taking still shots and the other for video, the rest of the screen should be taken up by a camera interface showing the cameras view.

The android developer documentation mainly talks about using androids built in camera and then saving the result in one of my own variables, which I dont want to do.

Resouces I have taken a look at

  • Android developer documentation

  • Random Google tutorials & stackoverflow

  • Android arsenal and 3rd party created libraries.

    Material Camera looks good but as soon as I try and add its dependancy to my apps build gradle I get an error, so that one doesn't work.

    CWAC-Cam2 looks really complicated, I don;t understand how to implement this

Answer Source

This is the resource you couldn't find: Using Camera inside app

Also, check the stackoverflow documentation section

Basically for taking photo you'll need to access the camera resource through:

Then create a class for showing the preview like the following:

public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback

For capturing you'll need a PictureCallback.

For video recording checkt the first source at the Capturing videos section; there you'll need a MediaRecorder.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download