编程完成子活动

由网友(身拥海洋。)分享简介:我有启动与 startActivityForResult 方法的另一个活动的活动。我想以编程方式终止所谓的一个,但我不知道如何做到这一点,因为在 onActivityResult()办法我也没有对所谓的活动信息,我不能打电话完成()就可以了。我怎样才能做到这一点?I have an activity that lau...

我有启动与 startActivityForResult 方法的另一个活动的活动。我想以编程方式终止所谓的一个,但我不知道如何做到这一点,因为在 onActivityResult()办法我也没有对所谓的活动信息,我不能打电话完成()就可以了。我怎样才能做到这一点?

I have an activity that launches another activity with startActivityForResult method. I would like to terminate the called one programmatically but I don't know how to do this since in onActivityResult() method I have no information about the called activity and I cannot call finish() on it. How can I achieve this?

感谢

推荐答案

尝试的 finishActivity(要求code)。根据该文件它可以让你完成一项活动previously开始startActivityForResult。如果存在具有相同的请求code多这样的活动,一切都将结束了。

Try finishActivity(requestCode). According to the documentation it lets you finish an activity previously started with startActivityForResult. And if there are multiple such activities with the same request code, all will be finished.

注:我还没有真正尝试过这个自己,但这是什么文件说!实验与,看它是否你想要做什么。

Note: I haven't actually tried this myself, but that's what the documentation says! Experiment with that, see if it does what you want.

阅读全文

相关推荐

最新文章