gpt4 book ai didi

android - 使用相机 Intent 拍摄的照片在 ImageView (7.0+) 上质量低

转载 作者:太空狗 更新时间:2023-10-29 16:11:47 24 4
gpt4 key购买 nike

<分区>

我知道有很多这样的例子,但我还没有找到适用于 7.0+ 的可靠例子。我知道我正在设置图像的缩略图而不是原始图像,但我不确定如何获取它。

这是我的代码:

if( ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(new String[]{android.Manifest.permission.CAMERA},
CAMERA_REQUEST_CODE);

}

}else{
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takePictureIntent, CAMERA_REQUEST_CODE);
}
}

}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_REQUEST_CODE&& resultCode == RESULT_OK && data != null ) {

Bitmap bitmap = (Bitmap) data.getExtras().get("data");
mImageView.setImageBitmap(bitmap);




}}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com