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
Missing call to removeActivityResultListener #156
Comments
@hnvn I can send a PR for this and retest my app. Or else let me know if you're already started working on it, and I'll wait for the commit for my test. |
You're welcome to PR |
@fmatosqg @hnvn I solved problem with your link. +@ package vn.hunghd.flutter.plugins.imagecropper; import android.util.Log; import androidx.appcompat.app.AppCompatDelegate; /** ImageCropperPlugin */ private class LifeCycleObserver
} static private static final String CHANNEL = "plugins.hunghd.vn/image_cropper"; // private static ImageCropperPlugin instance; private MethodChannel channel; private final Object initializationLock = new Object(); /** Plugin registration. */ @OverRide public ImageCropperPlugin() {} @VisibleForTesting @OverRide @OverRide @OverRide @OverRide @OverRide @OverRide private void setup( private void tearDown() { private final ImageCropperDelegate constructDelegate(final Activity setupActivity) { |
@mc10sw I'm sorry I can't read such long code in a github comment. Pls consider making a PR so we can diff your changes and understand them better using a proper editor. That said, at first glance it looks pretty much like another plugin I was reading for tracking down my problems, but I think in this case we can get away without using a lifecycle and observer since we have a simple use case. @hnvn I cleaned the whole file and have an implementation that works with my project. Seems like the problem was with the Do you have any objections against kotlin? My suggestion would be to rewrite |
Thanks @fmatosqg , I don't have any objections against kotlin. I choose Java for this plugin in the first place because I feel more confident with my Java experience rather than to kotlin. You are welcome to refactor the plugin with kotlin. |
Ah, Sorry @fmatosqg , I miss your PR. I will have a look at it. |
Merged and released as v1.2.3 |
I believe
onDetachedFromActivity
andonDetachedFromActivityForConfigChanges
should callremoveActivityResultListener
as shown in this official flutter plugin: https://github.com/flutter/plugins/blob/master/packages/image_picker/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.javaI believe this may be behind a crash I was facing in an app I'm developing, but need further investigation to find out if/how they're related.
My successfull flow is like following:
My crash happens if:
The text was updated successfully, but these errors were encountered: