检测活动启动的结果 [英] Detecting activity is started for result
问题描述
我的活动想活动一,我开始通过两种方式
一) StartActivity()
B) StartActivityForResult()
现在我有是具有对活动方式不同的行为,一些方法开始。现在我想以检测活动A开始的结果。
所以我的问题是如何,我们可以发现,该活动已启动的结果呢?
我不想通过故意发送数据。任何其他方式更广义的?
I've an activity suppose "Activity A" which I start by two ways
a)StartActivity()
b) StartActivityForResult()
Now I have few methods which are having different behaviours for the way activity started. Now I want to detect that "Activity A" is started for result.
So my question how we can detect that the activity is started for result?
I don't want to send data through intent. Any other way more generalized?
感谢你。
推荐答案
发送一些布尔额外时,它使用一个名为
Send some boolean Extra when its called using
intent.putExtra("mBool", true);
startActivityForResult(intent);
根据该值,相应的动作就完成了。
Depending on that value, respective actions are done.
if(getIntent().hasExtra("mBool")){
//ForResult
}else{
//default
}
这篇关于检测活动启动的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!