如何传递从目前的活动数据已暂停的活动?目前、数据

2023-09-06 06:38:02 作者:笑醉生梦

我想知道如何从当前的活动数据传递到暂停活动。

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().

 
精彩推荐