2

I have a vehicle inspection application that is working, except on a Samsung Galaxy 4. Using a camera intent, the user takes a picture, selects ok, then onActivityResult, it crashes. As you can see, I am using iText to create a PDF later in the code, but I create the iText Image. Does anyone have a clue on this specific issue???

 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    tireTreadImageView = (ImageView) findViewById(id.tire_tread_image);
    insideVanCleanImageView = (ImageView) findViewById(id.inside_van_clean_image_view);
    windshieldConditionImageView = (ImageView) findViewById(id.windshield_image_view);
    Bitmap bitmap;
    BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
    File f;
    ByteArrayOutputStream bmpStream = new ByteArrayOutputStream();

    if (resultCode == RESULT_OK) {

        switch (requestCode) {
            case TIRE_TREAD_CAMERA_INTENT:
                f = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "temp_tire_tread.jpg");
                bitmap = BitmapFactory.decodeFile(f.toString(), bitmapOptions);
                //imageCaptured = (Bitmap) data.getExtras().get("data");
                tireTreadImageView.setImageBitmap(bitmap);
                tireTreadImage = bitmap;

                tireTreadImage.compress(Bitmap.CompressFormat.JPEG, 15, bmpStream);

                try {
                    tireTreadCellImage = Image.getInstance(bmpStream.toByteArray());
                } catch (BadElementException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                break;

            case VAN_CLEAN_CAMERA_INTENT:
                f = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "temp_van_clean.jpg");
                bitmap = BitmapFactory.decodeFile(f.toString(), bitmapOptions);
                //imageCaptured = (Bitmap) data.getExtras().get("data");
                insideVanCleanImageView.setImageBitmap(bitmap);
                insideVanCleanImage = bitmap;

                insideVanCleanImage.compress(Bitmap.CompressFormat.JPEG, 15, bmpStream);

                try {
                    insideVanCleanCellImage = Image.getInstance(bmpStream.toByteArray());
                } catch (BadElementException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                break;

            case WINDSHIELD_CAMERA_INTENT:
                f = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "temp_windshield.jpg");
                bitmap = BitmapFactory.decodeFile(f.toString(), bitmapOptions);
                //imageCaptured = (Bitmap) data.getExtras().get("data");
                windshieldConditionImageView.setImageBitmap(bitmap);
                windshieldImage = bitmap;

                windshieldImage.compress(Bitmap.CompressFormat.JPEG, 15, bmpStream);

                try {
                    windshieldConditionCellImage = Image.getInstance(bmpStream.toByteArray());
                } catch (BadElementException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                break;
        }
    }
    bmpStream.reset();
}
George Mulligan
  • 11,813
  • 6
  • 37
  • 50
  • 3
    Post the stack trace of the crash. – Sébastien Jan 26 '16 at 17:01
  • I unfortunately do not have it. It is from a user who cannot send me this info. Was hoping someone has seen this before and could offer a suggestion...... – Victor Humphrey Jan 26 '16 at 17:11
  • 1
    you will have a hard time debugging this without logs. You have at least 3 options: 1) If the app is published, get the stack trace from Google Play crash reports 2) Use some 3rd party crash analysis SDK like Crashlytics 3) Get a Galaxy S4 to reproduce the crash – Sébastien Jan 26 '16 at 17:16

1 Answers1

0

As Sebastien said, you should try to find more information about this issue. There are some discussions about related questions/answers here:

Hope it helps,

Community
  • 1
  • 1
Nikiole91
  • 344
  • 2
  • 10