简体   繁体   English

相机意图拍摄两个图像

[英]Camera Intents taking two images

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. 在我的应用程序中,我正在使用相机意图捕获图像。代码可以正常工作,但是有一个问题。我单击的图像被保存了两次。一个是普通图像,另一个是压缩图像(可能是缩略图)。我有一个图像查看我要显示用户单击的图像的位置,但在我的图像视图中,图像质量非常差。在我的画廊中,同一图像也被保存两次(正常质量为1),其他图像质量很差。

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); 

}

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. 堆栈溢出和网络上有很多帖子,列出了不同设备和Android版本上的各种问题。 Feel free to check out my solution to the problem on GitHub: https://github.com/ralfgehrer/AndroidCameraUtil 随时在GitHub上查看我的问题解决方案: https : //github.com/ralfgehrer/AndroidCameraUtil

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM