微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 Android11 中,我想使用该设备的默认裁剪器并使用 Crop Intent 可能吗?

如何解决在 Android11 中,我想使用该设备的默认裁剪器并使用 Crop Intent 可能吗?

在 Android11 中,我想使用该设备的认裁剪器并使用 Crop Intent 可以吗?

代码可在 android 11 以下运行,但不能在 android 11 startactivity 上运行,结果未给出结果 ok 。 我试过这个代码.......

   Intent intent = new Intent("com.android.camera.action.CROP");
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
            intent.setType("image/*");
            List<ResolveInfo> list = mContext.getPackageManager().queryIntentActivities(intent,0);
            int size = list.size();
            if (size == 0) {
                Toast.makeText(mContext,"Can not find image crop app",Toast.LENGTH_SHORT).show();
              
             
            } else {
                intent.setDataAndType(sourceImage,"image/*");
                intent.putExtra("aspectX",ASPECT_X);
                intent.putExtra("aspectY",ASPECT_Y);
                intent.putExtra("outputY",OUT_PUT_Y);
                intent.putExtra("outputX",OUT_PUT_X);
                intent.putExtra("scale",SCALE);
    
                //intent.putExtra("return-data",true);
                intent.putExtra(MediaStore.EXTRA_OUTPUT,destinationImage);
                selectedImageUri = destinationImage;
               
                Intent i = new Intent(intent);
                ResolveInfo res = list.get(0);
                i.setComponent(new ComponentName(res.activityInfo.packageName,res.activityInfo.name));
                ((Activity) mContext).startActivityForResult(i,SELECTED_IMG_CROP);
                
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。