Transfer data between unrelated activities

时间:2017-12-18 07:24:52

标签: android android-intent android-activity

I have three activities suppose ActivityA, ActivityB and ActivityC where A has started B and B started C then B is destroyed.
Now I have to transfer some data back to ActivityA from ActivityC.

How can I achieve this without using SharedPreference or database in android?

2 个答案:

答案 0 :(得分:2)

Make one Constant.class and declare string

x.IndexOf(k, StringComparison.OrdinalIgnoreCase)

now in your Activity C . store your Value like this.

public static String your_value = "";

and in your Activity A . access like this.

Constant.your_value = "123456";

答案 1 :(得分:-1)

use *.qm method for sending data back

In setResult() use this.

ActivityC

Now in your Intent intent = new Intent(); intent.putExtra("data", "yourdata") setResult(RESULT_OK, intent); finish(); override method activityA

onActivityResult()

Happy coding!!

相关问题