首页 > 解决方案 > ArthurHub 裁剪图像未转换为位图

问题描述

我目前在android studio(java)中使用ArthurHub作为我的图像裁剪器,我想将裁剪的图像转换为位图,但是当我运行它时,一旦我完成裁剪,它就会突然崩溃。我希望有人能解决这个问题。谢谢你。

继承人的代码:

    if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
            CropImage.ActivityResult result = CropImage.getActivityResult(data);
            if (resultCode == RESULT_OK) {
                Uri resultUri = result.getUri();
                ImageView imageResult = findViewById(R.id.imageView1);
                imageResult.setImageURI(resultUri);
                bundle = data.getExtras();
                Bitmap bitmap = (Bitmap) bundle.get("data");
                imageResult.setImageBitmap(bitmap); 

            } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
                Exception error = result.getError();
            }
        }
   

标签: javaandroidandroid-studio

解决方案


推荐阅读