Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CropImageView SavedState takes too much space and crashes #82

Closed
GrindingOgre opened this issue Sep 27, 2016 · 4 comments
Closed

CropImageView SavedState takes too much space and crashes #82

GrindingOgre opened this issue Sep 27, 2016 · 4 comments

Comments

@GrindingOgre
Copy link

Be careful on the CropImageView.onSaveInstanceState, because if i use a big bitmap, there's a chance that the app crashes.

I have CropImageView inside a fragment, and, when the app goes in background, it throws TransactionTooLargeException.
I've seen on onSaveInstanceState method that you save the bitmap inside the Bundle and i don't think this is a good practice.

To avoid this crash, i call setImageDrawable(null) when the Fragment goes inside onPause method

@Rainer-Lang
Copy link
Contributor

@GrindingOgre I have the same problem. Do you have a solution?

@Nuclominus
Copy link

@Rainer-Lang you may create fast-fix like say @GrindingOgre.

  1. Call mCropView.setImageDrawable(null) in onPause methode on MainFragment
  2. Move setImageResource image from onViewCreated to onResume.

@GrindingOgre
Copy link
Author

I used the same workaround as @Nuclominus and it worked just fine. Just don't use Glide or Picasso because there are some weird behaviour on some devices, like bitmap inside the view was overly scaled.

Unfortunately i had to switch to another library because this one didn't have all the features i need.

@igreenwood
Copy link
Owner

In the new version, CropImageView does not save bitmap internally . Please use the version 1.1.5 and see also new sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants