暂停和恢复 ActivityGroup 中的子活动
我正在第一次尝试创建自定义 ActivityGroup。除了组子活动的活动生命周期方法之外,我正在让一切正常工作。当子活动进入/退出焦点时,如何调用 onResume/onPause 方法?
我知道 tabActivity 会执行此操作,但在查看代码时我找不到如何操作。
提前致谢!
I am making a first try att creating a custom ActivityGroup. I am getting everything working except the activity lifecycle methods of the groups child activities. How can i call the onResume/onPause methods in my child activities when they enter/exit focus?
I know the tabActivity does this but i cannot find how when looking through the code.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有类似的问题。我认为这与活动组如何存储历史有关。如果将视图存储在数组列表中,则并不总是调用 onresume/onpause 。我通过使用此实现来解决它,它将活动 ID 存储在数组列表中而不是视图中,并且我发现 onresume 和 onpause 被调用。
http://ericharlow.blogspot.com/2010/09/experience -multiple-android-activities.html
i had a similar problem. I think it has to do with how the activitygroup stores history. if you store the views in the arraylist, then the onresume/onpause isn't always called. I solved it by using this implementation instead, which stores activity id's in the arraylist instead of views, and I found that the onresume and onpause were called.
http://ericharlow.blogspot.com/2010/09/experience-multiple-android-activities.html