Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Can't select or upload photos #30

Closed
samtstern opened this issue Feb 12, 2018 · 0 comments
Closed

Can't select or upload photos #30

samtstern opened this issue Feb 12, 2018 · 0 comments
Labels

Comments

@samtstern
Copy link
Contributor

On my pixel I get this log when I select a picture:

02-12 08:09:04.781 9858-10003/com.google.firebase.samples.apps.friendlypix E/NewPostTaskFragment: Error occurred during resize: Resetting to invalid mark
02-12 08:09:04.782 9858-9858/com.google.firebase.samples.apps.friendlypix E/NewPostActivity: Couldn't resize bitmap in background task.

Chasing it down, it looks like it comes from one of the stream.reset() calls in this function:

    public Bitmap decodeSampledBitmapFromUri(Uri fileUri, int reqWidth, int reqHeight)
            throws IOException {
        InputStream stream = new BufferedInputStream(
                mApplicationContext.getContentResolver().openInputStream(fileUri));
        stream.mark(stream.available());
        BitmapFactory.Options options = new BitmapFactory.Options();
        // First decode with inJustDecodeBounds=true to check dimensions
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(stream, null, options);
        stream.reset();
        options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
        options.inJustDecodeBounds = false;
        BitmapFactory.decodeStream(stream, null, options);
        // Decode bitmap with inSampleSize set
        stream.reset();
        return BitmapFactory.decodeStream(stream, null, options);
    }
@samtstern samtstern added the bug label Feb 12, 2018
samtstern added a commit that referenced this issue Feb 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant