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

Detect incorrect uses of viewLifecycleOwner in a Fragment #22

Open
jacob-peterson opened this issue Mar 1, 2023 · 2 comments
Open

Detect incorrect uses of viewLifecycleOwner in a Fragment #22

jacob-peterson opened this issue Mar 1, 2023 · 2 comments

Comments

@jacob-peterson
Copy link
Collaborator

jacob-peterson commented Mar 1, 2023

Calling Fragment.getViewLifecycleOwner() outside of the view's lifecycle will result in an IllegalStateException. E.g. in the init block or onCreate.

Example crash -- Would be difficult to catch this one since it is called from outside of the current fragment.

@jacob-peterson jacob-peterson changed the title Detect incorrect uses of viewLifecycleOwner Detect incorrect uses of viewLifecycleOwner in a Fragment Mar 1, 2023
@jacob-peterson
Copy link
Collaborator Author

Might be another candidate for upstreaming into Androidx.

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

No branches or pull requests

1 participant