如何传递从目前的活动数据已暂停的活动? [英] How can I pass data from the current Activity to a paused Activity?
本文介绍了如何传递从目前的活动数据已暂停的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何从当前的活动数据传递到暂停活动。
I want to know how to pass data from the current Activity to a paused Activity.
请指教。
推荐答案
让我们叫暂停的活动A和当前活动B。
Let's call the paused Activity "A" and the "current" Activity "B".
有乙沟通结果为A的方式是一个叫 startActivityForResult()
而不是 startActivity()
,和B到使用的setResult()
来提供的返回值(S)。 A随后接收这些返回值的onActivityResult()
。
The way to have B communicate results to A is for A to call startActivityForResult()
instead of startActivity()
, and for B to use setResult()
to provide the return value(s). A then receives those return values in onActivityResult()
.
这篇关于如何传递从目前的活动数据已暂停的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文