简体   繁体   English

当一个活动保持任务状态时,在两个活动之间传递数据?

[英]Passing data between 2 activities when one activity is retaining task state?

I have 2 activities in which i have to get data from activity 1 and then move to activity 2 to get additional data and then move back to previous activity (activity 1) with combined data to be send using retrofit. 我有2个活动,其中我必须从活动1中获取数据,然后移至活动2中以获取其他数据,然后再返回至先前的活动(活动1),并使用翻新的方式发送合并的数据。 Here activity 1 is retaining task state = true so when getting intent.putdata from activity 2 no data is passed to activity 1. So how to pass data to activity 1 while retaining its state. 在这里,活动1保持任务状态= true,因此从活动2获取intent.putdata时,没有数据传递到活动1。因此,如何在保持活动状态的同时将数据传递到活动1。

您可以使用此处所述的共享首选项: https : //developer.android.com/reference/android/content/SharedPreferences

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM