Android 当activity A 启动了activityB C D之后再返回A
高洛峰
高洛峰 2017-04-17 17:46:15
0
2
489

并且销毁BCD还要刷新A内的数据,应该要用starActivityForResult么?单例模式能行么?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
伊谢尔伦

If A will only be returned in B, then use startActivityForResultstartActivityForResult

如果在B, C, D都有可能返回A, 同时不会有同时两个A的话, 使用SingleTask模式, 直接在B/C/D中直接启动A, 根据singleTask的特性就会自动销毁A之后启动的Activity, 返回数据可以直接通过intent传数据, 然后再onNewIntent()

If it is possible to return A in B, C, and D, and there will not be two A at the same time, use SingleTask mode to directly start A in B/C/D. According to the characteristics of singleTask, A will be automatically destroyed. For the started Activity, the returned data can be transferred directly through the intent, and then the data can be received in onNewIntent() to refresh the view🎜
伊谢尔伦

Direct call back to A can be achieved by clearing the top of the stack or directly finishing when switching between B, C, and D.
Refreshing the page when returning to A can be achieved through the onResume method or broadcast.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template