0
votes

In my application i am using camera intent to capture image.The code works fine but it has a problem.The image which i click are saved twice.One the normal image and other compressed image(may be its thumbnail).I have a image view where i wanna display image which user clicks but in my imageview the image quality is very poor.In my gallery also the same image is saved twice 1 with normal quality and other with very poor quality.

Code

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 2);

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);


    if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE && resultCode == RESULT_OK && null != data) {

            Bitmap CameraImage = (Bitmap) data.getExtras().get("data");
            mainImage.setImageBitmap(CameraImage);
            Uri uri = getImageUri(this, CameraImage); 

}
1

1 Answers

0
votes

The Camera Intent is an annoying thing to implement. There are many posts across stack overflow and the web that list all sort of problems on different devices and Android versions. Feel free to check out my solution to the problem on GitHub: https://github.com/ralfgehrer/AndroidCameraUtil