티스토리 뷰

출처 : https://github.com/ArthurHub/Android-Image-Cropper



이거 존나 거지같은 라이브러리임.

crop 누르면 그 비트맵이 null뜬다 왜지..


onActivityResult 내에서 디버깅 했는데도 계속 null...


 
@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        //TODO : bitmap cropped is null..

        if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
            CropImage.ActivityResult result = CropImage.getActivityResult(data);

            if (resultCode == RESULT_OK) {
                Uri resultUri = result.getUri();
                Log.d(TAG, "crop click");

                if (cropped != null) {
                    Log.d(TAG, "cropped image show");
                    cropImageView.setImageBitmap(cropped);

                }

//                Intent toTicketView = new Intent(ImageProcessingActivity.this, TicketViewActivity.class);
//                toTicketView.setData(resultUri);
//                toTicketView.putExtra("ticket", photoTicket);
//                startActivity(toTicketView);

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

    }


+

7/10 추가

해결방법

intent 로 bitmap을 넘기지 말고,

임시 파일로 저장한 후 파일 이름을 인텐트로 넘겨서 다음 액티비티에서 그 파일을 로드하는 방식으로 접근하면 됨


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
글 보관함