我在我的应用程序中遇到内存问题,它使用 TabHost 和 TabGroupActivity 作为 TabContent。
我注意到有时 Activity 的生命周期很奇怪。
我启动应用程序,加载了 tab1,然后单击 tab2 (Tab1->Tab2 )
Tab1Group.onPause called
Tab1.onPause called
Tab2Group.onCreate called
Tab2.onCreate called
然后我返回 Tab1 (Tab2->Tab1)
Tab2Group.onPause called
Tab1Group.onDestroy called
Tab1.onDestroy called
Tab1.onCreate called
好吧,如果我回来时 tab1 被破坏了,最好直接破坏它而不是调用onPause
,这样 VM 可以释放更多内存。
你怎么看 ?