Java 裁剪后裁剪应用程序崩溃

Java 裁剪后裁剪应用程序崩溃,java,android,Java,Android,谷歌照片截取后就崩溃了。也许我没有正确地发送图像或其他东西,但它只是无缘无故地崩溃了。裁剪应用程序中的图像看起来正常。我的性交结果 protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); try { if (requestCode == RESULT_L

谷歌照片截取后就崩溃了。也许我没有正确地发送图像或其他东西,但它只是无缘无故地崩溃了。裁剪应用程序中的图像看起来正常。我的性交结果

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    try {
        if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK
                && null != data) {
            Uri selectedImage = data.getData();

            Intent cropIntent = new Intent("com.android.camera.action.CROP");
            cropIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
                    selectedImage);

            cropIntent.setData(selectedImage);
            cropIntent.putExtra("crop", "true");
            cropIntent.putExtra("aspectX", 7);
            cropIntent.putExtra("aspectY", 9);
            cropIntent.putExtra("outputX", 450);
            cropIntent.putExtra("outputY", 350);
            cropIntent.putExtra("return-data", false);
            startActivityForResult(cropIntent, RESULT_CROP_IMG);
        } else if (requestCode == RESULT_CROP_IMG && resultCode == RESULT_OK && data != null) {
            Uri cropedImage = data.getData();
            String[] filePathColumn = { MediaStore.Images.Media.DATA };

            // Get the cursor
            Cursor cursor = getContentResolver().query(cropedImage,
                    filePathColumn, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            imgDecodableString = cursor.getString(columnIndex);
            cursor.close();

            getSharedPreferences("main", MODE_PRIVATE).edit().putString(Const.CARD_IMAGE, imgDecodableString).apply();
            photo.setImageBitmap(BitmapFactory.decodeFile(imgDecodableString));
        }
    } catch (Exception e) {
        Toast.makeText(this, "Произошла ошибка", Toast.LENGTH_LONG)
                .show();
    }

}
日志:


似乎您的列索引为-1。有很多。请使用一个。请以文本而不是图像的形式发布错误消息。您解决了吗?如果不介意的话,发布完整的log.com看起来像是您的列索引=-1。有很多。请使用一个。请以文本而不是图像的形式发布错误消息。您解决了吗?如果不介意发布完整日志。