title: Use camera but dont want to take photo
body: <p>I want to use camera in my app but dont want to take photo, actually I am making a app i.e transparent screen, in this I want to show transparent wallpaper i.e I have to start camera for this and i dont want to take images for this</p>
  <p>I tried all these codes but have n't got the desirable results. Can anyone suggest what must i do?
  used this permission in all cases</p>
  <pre><code>&lt;uses-permission android:name=&quot;android.permission.CAMERA&quot;/&gt;
  
  
  
   Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  startActivity(intent);
  </code></pre>
  <hr />
  <pre><code>Intent intent = new Intent(Intent.ACTION_CAMERA_BUTTON, null);
  startActivity(intent);
  </code></pre>
  <hr />
  <pre><code>    Intent intent = new Intent(android.provider.MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
      startActivity(intent);
  </code></pre>
  <p>Update 1:</p>
  <p>I tried this code it showing camera in not correct way, its diverting the preview to right kindly look over this updated code and tell wht amendment i can make over this</p>
  <pre><code>public class MainActivity extends Activity {
      
      private Preview mPreview;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          try{
          requestWindowFeature(Window.FEATURE_NO_TITLE);
  
          // Create our Preview view and set it as the content of our activity.
          mPreview = new Preview(this);
          setContentView(mPreview);
          }catch(Exception e){
              e.printStackTrace();
          }
      }
  
  ******************************************************************************************
  
  public class Preview extends SurfaceView implements SurfaceHolder.Callback {
  SurfaceHolder mHolder;
  Camera mCamera;
  
  Preview(Context context) {
      super(context);
  
      // Install a SurfaceHolder.Callback so we get notified when the
      // underlying surface is created and destroyed.
      try{
      mHolder = getHolder();
      mHolder.addCallback(this);
      mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
      }catch(Exception e){
          e.printStackTrace();
      }
  }
  
  public void surfaceCreated(SurfaceHolder holder) {
      // The Surface has been created, acquire the camera and tell it where
      // to draw.
      try{
          if(mCamera!=null){
              mCamera.release();
              mCamera=null;
          }
      mCamera = Camera.open();
    Log.i(&quot;Camera&quot;, &quot;Camera is opened&quot;);
          mCamera.setPreviewDisplay(holder);
      } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  
  public void surfaceDestroyed(SurfaceHolder holder) {
      // Surface will be destroyed when we return, so stop the preview.
      // Because the CameraDevice object is not a shared resource, it's very
      // important to release it when the activity is paused.
      try{
      mCamera.stopPreview();
      mCamera.release();
      mCamera = null;
      }catch(Exception e){
          e.printStackTrace();
      }
  }
  
  public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
      // Now that the size is known, set up the camera parameters and begin
      // the preview.
      try{
      Parameters parameters = mCamera.getParameters();
      List&lt;Camera.Size&gt; sizes = parameters.getSupportedPreviewSizes();  
      Camera.Size cs = sizes.get(0);  
      parameters.setPreviewSize(cs.width, cs.height);
      mCamera.setParameters(parameters);
      mCamera.startPreview();
      }catch(Exception e){
          e.printStackTrace();
      }
  }
  </code></pre>
  <p>}</p>
  <p><img src="https://i.stack.imgur.com/ueewM.jpg" alt="enter image description here" /></p>