[英]How to save View's state after pause?
When my app completes some async tasks, it notifies UI about it. 当我的应用程序完成一些异步任务时,它会通知UI。
For example: 例如:
-> async work started
-> async work started
-> state is saved
-> state is saved
-> async work finished
(note that my activity is paused) -> async work finished
(请注意,我的活动已暂停) state is restored
and View's state updated in 3 step is gone while work was finished! state is restored
,视图的状态在3步中更新了! How to deal with such cases? 如何处理此类案件? Is there any way to save settings after app is paused?
应用暂停后,有什么方法可以保存设置?
考虑使用MvpQueuingBasePresenter或Model-View-Intent,它可以更好地处理与生命周期相关的事情。
I think you should update the state of the view in onResume method from that activity. 我认为您应该从该活动的onResume方法中更新视图的状态。
ref: https://developer.android.com/guide/components/activities/activity-lifecycle.html 参考: https : //developer.android.com/guide/components/activities/activity-lifecycle.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.