compress image while taking an image in android
<p>Hello I am developing a CAMERA APPLICATION. After taking an image the image will be save in sdcard. I want while saving in sdcard the size of the image should be 400kb to 500kb but now its taking more than 1mb. How to compress and save in sdcard after capturing the image.</p>

<p>My code is</p>

<pre><code> public void onClick(View v) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            imageName="MyCameraApp" + String.valueOf(System.currentTimeMillis()) + ".jpg";
            File file = new File(Environment.getExternalStorageDirectory()+"/pictures", imageName);
            fileUri = Uri.fromFile(file);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name

            startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);

        }
</code></pre>
