Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

Memory leaks #57

Open
yikuo123 opened this issue Aug 24, 2018 · 0 comments
Open

Memory leaks #57

yikuo123 opened this issue Aug 24, 2018 · 0 comments

Comments

@yikuo123
Copy link

        this.activityLifecycleCallbacks = new ActivityLifecycleCallbacks() {
            public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
                ActivitiesLifecycleCallbacks.this.liveActivityOrNull = activity;
            }

            public void onActivityStarted(Activity activity) {
            }

            public void onActivityResumed(Activity activity) {
                ActivitiesLifecycleCallbacks.this.liveActivityOrNull = activity;
            }

            public void onActivityPaused(Activity activity) {
                ActivitiesLifecycleCallbacks.this.liveActivityOrNull = null;
            }

            public void onActivityStopped(Activity activity) {
            }

            public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
            }

            public void onActivityDestroyed(Activity activity) {
            }
        };

If I finish an activity inside onCreate , the method onActivityPaused won't be called. ActivitiesLifecycleCallbacks.this.liveActivityOrNull don't free the reference to the activity and causes memory leaks!

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

1 participant