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

MainActivity 中的tab页面fragment 管理 存在内存泄漏问题 #133

Open
songsforjane opened this issue Jan 19, 2024 · 0 comments
Open

Comments

@songsforjane
Copy link

MainActivity 中的tab页面fragment 管理 有内存泄漏。

操作:切换 白天/黑夜主题

原因:Activity 重建了, 但是 FragmentManager 的状态没有重置(原先add进去的fragment对象还存在)

修复方案:给每个 fragment 一个 固定id,add 前判定该fragment 是否已经add 过了。

另外:基于系统的换肤方案,是否都必须重建activity 呢?

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

No branches or pull requests

1 participant