Android 如何向调用方返回将在活动中更新的值

Android 如何向调用方返回将在活动中更新的值,android,Android,我需要计算活动中的参数值并返回结果 我的代码如下所示: public String getMyValue(){ Intent intent = new Intent(context, MyWebView.class); context.startActivity(intent); return myValue; } 下面是我的MyWebView课程 MyWebView extends Activity{ protected void onCreate(){ myValue = a+b;

我需要计算活动中的参数值并返回结果

我的代码如下所示:

public String getMyValue(){
Intent intent = new Intent(context, MyWebView.class);
context.startActivity(intent);
return myValue;
}
下面是我的MyWebView课程

MyWebView extends Activity{
 protected void onCreate(){
 myValue = a+b;
 }
}
所以,如果我调用下面的代码,每次都会得到null

String a = getValue();
我的问题是,在“活动”中更新“myValue”后,如何返回它。 请让我知道,如果有其他方法来做这件事

我的问题是,如何在中更新“myValue”后返回它 活动

要从“活动”中获取结果,需要使用
startActivityForResult()
。网上有很多例子,所以这里不包括