Camera 2 - API - Image capturing is not working when using Front Camera?
<p>In my camera app i have a button to change the camera facing in to  front or back  ,I can capture and save images using back camera ,but when i switch to front camera i could not capture images . This is how i am switching camera to front or back .</p>

<pre><code>   ImageView switch_camera =(ImageView) rootview.findViewById(R.id.imageView7);
        switch_camera.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {


         //       facing = characteristics.get(CameraCharacteristics.LENS_FACING);

                if (facing != null &amp;&amp; facing == CameraCharacteristics.LENS_FACING_FRONT) {
                    //isfrontcam=true;
                    try {

                        //manager.openCamera(getBackFacingCameraId(manager), mStateCallback, mBackgroundHandler);
                        closeCamera();
                        openCamera(mTextureView.getWidth(), mTextureView.getHeight(),"0");
                        Log.e("opening ","BackCam");
                        facing = 1;

                    } catch (SecurityException e) {
                        e.printStackTrace();

                    } catch (Exception e) {
                        e.printStackTrace();

                    }
                } else if (facing != null &amp;&amp; facing == CameraCharacteristics.LENS_FACING_BACK) {
                    //  isfrontcam = true;
                    try {
                        //manager.openCamera(getFrontFacingCameraId(manager), mStateCallback, mBackgroundHandler);

                      //  characteristics = manager.getCameraCharacteristics("1");

                        closeCamera();
                        openCamera(mTextureView.getWidth(), mTextureView.getHeight(),"1");

                        Log.e("opening ", "FrontCam");
                        String str = getBackFacingCameraId(manager);
                        facing= 0;
                        Log.e("str", "id" + str);

                    } catch (SecurityException e) {
                        e.printStackTrace();

                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
</code></pre>

<p>On capture button click ,i am calling this function to capture images ;</p>

<pre><code> private void lockFocus() {
        try {
            // This is how to tell the camera to lock focus.
            mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER,
                    CameraMetadata.CONTROL_AF_TRIGGER_START);
            // Tell #mCaptureCallback to wait for the lock.
            mState = STATE_WAITING_LOCK;
            mCaptureSession.capture(mPreviewRequestBuilder.build(),mCaptureCallback,
                    mBackgroundHandler);
        } catch (CameraAccessException e) {

            e.printStackTrace();
        }
    }
</code></pre>