title: Generating preview of image after being captured from camera
body: <p>I am trying to create an app which uses custom camera using camera 2 api for clicking pictures. In my app, I want to take a picture and after taking picture, a preview of the captured image should immediately display in order to discard or accept it. I am a beginner so, it is quite confusing for me to how to do it. Below is my code for image capture:</p>
  
  <pre><code>private void startImageCaptureRequest() throws CameraAccessException 
  {
   xadCaptureRequestBuilder=xaCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
   xadCaptureRequestBuilder.addTarget(xaImageReader.getSurface());
   xadCaptureRequestBuilder.set(CaptureRequest.JPEG_ORIENTATION,xaTotalRotation);
   CameraCaptureSession.CaptureCallback stillCaptureCallback=new CameraCaptureSession.CaptureCallback() {
  
   @Override
   public void onCaptureStarted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, long timestamp, long frameNumber) {
   super.onCaptureStarted(session, request, timestamp, frameNumber);
    try {
                  createXaFileName();
              } catch (IOException e) {
                  e.printStackTrace();
              }
  
  
  
       }
      };
      xaPreviewImageSession.capture(xadCaptureRequestBuilder.build(),stillCaptureCallback,null);
  }
  </code></pre>
  
  <p>I want two consecutive images for my app.How could I do it? Please help.</p>