问题描述
我已经创建了3项活动: firstActivity
, secondActivity
和 thirdActivity
。
I have created 3 activities: firstActivity
, secondActivity
, and thirdActivity
.
-
firstActivity
的主要活动。 -
secondActivity
将只有当它收到一个短信,并随后将消息发送给thirdActivity
工作 -
thirdActivity
的字符串转换值双精度值,然后将双值firstActivity
。李>
firstActivity
is the main activity.secondActivity
will work only if it receives an SMS, and it then sends the message tothirdActivity
.thirdActivity
converts the string values to double values, and then sends the double values tofirstActivity
.
我可以给从 secondActivity
值 thirdActivity
,但我不知道该如何传递值从 thirdActivity
到 firstActivity
。请告诉我对我应该怎么做。
I can send values from secondActivity
to thirdActivity
, but I don't know how to pass values from thirdActivity
to firstActivity
. Please advise me on how I should do this.
推荐答案
只要你有要求的结果的活动,像在这种情况下,你有thirdActivity你可以随时使用的方法 startActivityForResult ,而不是仅仅startActivity。一旦thirdActivity已经完成它的处理,并要返回结果的价值,它应该调用的setResult,仅此而已。
Whenever you have an activity called for a result, like in this case you have thirdActivity you can always use the method startActivityForResult instead of just startActivity. Once thirdActivity has finished its processing and it wants to return the result value, it should call setResult and that's it.
在这里这种方法的问题是怎么样的,你有secondActivity在中间。是不是真的有必要吗?
The problem with this approach here is that you kind of have secondActivity in the middle. Is it really necessary?
这篇关于如何通过活动之间的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!