title: Add zoom to camera android
body: <p>I am new to android and currently working on an app which uses the camera API. I am having trouble with the implementation of Zoom function in the app. I am using Camera kit API to make the app and Camera-kit Api does not provide support for zoom controls. Please help me with the code required. I am unable to figure it out since a week. I need to implement Zoom to the camera Preview.</p>
  
  <p>this is my Code.</p>
  
  <pre><code>public class MicroscopeAcitvity extends AppCompatActivity implements View.OnClickListener {
  
      CameraView cameraView;
      ImageButton cameraTakePic;
      ImageButton buttonFlash;
      Camera mCamera; //= Camera.open();
      Camera.Parameters params;
      TextView T1,T2;
      int counter = 0;
  
  
  
  
      @Override
      protected void onCreate(@Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_microscope_acitvity);
  
          cameraView = (CameraView) findViewById(R.id.camera);
  
          cameraTakePic = (ImageButton) findViewById(R.id.button_take_picture);
          cameraTakePic.setOnClickListener(this);
  
          buttonFlash = (ImageButton) findViewById(R.id.button_Flash);
          buttonFlash.setOnClickListener(this);
  
          T1 = (TextView) findViewById(R.id.flash_text1);
          T1.setOnClickListener(this);
          //T1.setVisibility(View.GONE);
  
          T2 = (TextView) findViewById(R.id.flash_text2);
          T2.setOnClickListener(this);
          //T2.setVisibility(View.GONE);
  
  
          cameraView.setCameraListener(new CameraListener() {
  
  
              @Override
              public void onPictureTaken(byte[] picture) {
                  super.onPictureTaken(picture);
  
                  // Create a bitmap
                  Bitmap result = BitmapFactory.decodeByteArray(picture, 0, picture.length);
              }
          });
  
  
  
          cameraView.setFocus(CameraKit.Constants.FOCUS_TAP);
  
      }
  
  
  
      @Override
      protected void onResume() {
          super.onResume();
          cameraView.start();
      }
  
      @Override
      protected void onPause() {
          cameraView.stop();
          super.onPause();
      }
  
  
      @Override
      public void onClick(View v) {
          int id;
          id = v.getId();
  
          if(id == R.id.button_take_picture){
              cameraView.captureImage();
          }
  
          if(id == R.id.button_Flash){
             if(counter % 2 != 0){
                 T1.setVisibility(View.VISIBLE);
                 T2.setVisibility(View.VISIBLE);
                 counter = counter+1;
             }
             else{
                 T1.setVisibility(View.GONE);
                 T2.setVisibility(View.GONE);
                 counter = counter+1;
             }
  
          }
  
          if(id == R.id.flash_text1){
              T1.setTextColor(Color.RED);
              T2.setTextColor(Color.DKGRAY);
              cameraView.setFlash(CameraKit.Constants.FLASH_ON);
          }
  
          if (id == R.id.flash_text2){
              T2.setTextColor(Color.RED);
              T1.setTextColor(Color.DKGRAY);
              cameraView.setFlash(CameraKit.Constants.FLASH_OFF);
          }
  
  
      }
  } 
  </code></pre>