Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

"Error while saving image" when cropping #37

Closed
takacsm12 opened this issue Oct 16, 2019 · 2 comments
Closed

"Error while saving image" when cropping #37

takacsm12 opened this issue Oct 16, 2019 · 2 comments

Comments

@takacsm12
Copy link

After applying crop, toast "Error while saving image" is displayed.
Problem is probably in CropFragment , line 201: Single.fromCallable(() -> cropPanel.getCroppedImage());
method getCroppedImage is called from background thread, but it should not, because it works with view (mImageView.clearAnimation())
This problem does not happens on all devices, reproduced on Galaxy Tab S2 , Android 7

Stacktrace:
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:7831)
at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:1342)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:5449)
at android.view.View.invalidateInternal(View.java:14807)
at android.view.View.invalidate(View.java:14771)
at android.view.View.invalidateParentIfNeeded(View.java:14960)
at android.view.View.clearAnimation(View.java:21431)
at com.theartofdev.edmodo.cropper.CropImageView.getCroppedImage(CropImageView.java:763)
at com.theartofdev.edmodo.cropper.CropImageView.getCroppedImage(CropImageView.java:737)
at iamutkarshtiwari.github.io.ananas.editimage.fragment.crop.CropFragment.lambda$getCroppedBitmap$4$CropFragment(CropFragment.java:201)
at iamutkarshtiwari.github.io.ananas.editimage.fragment.crop.-$$Lambda$CropFragment$Y_hl9FvcrZ26G-Bb-gpLHqbxGQw.call(lambda)
at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44)
at io.reactivex.Single.subscribe(Single.java:3575)
at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)

@iamutkarshtiwari
Copy link
Owner

iamutkarshtiwari commented Oct 21, 2019

@takacsm12 I'd appreciate it if you could make a PR for this issue if you were able to fix it as I don't have this device on me. 🙏

@iamutkarshtiwari
Copy link
Owner

Fixed.

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

No branches or pull requests

2 participants