完成老活动,并开始一个新的,反之亦然 [英] Finish old activity and start a new one or vice versa

查看:75
本文介绍了完成老活动,并开始一个新的,反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,我得到了相同的结果既code snipplets

I know, that I get the same result with both code snipplets

finish();
startActivity(newActivity);

startActivity(newActivity);
finish();

我想知道你的意见,如果他们之间有一个很大的区别?或者,如果一个更好的另一个?为什么?

I'd like to know your opinion, if there is a big difference between them?! Or if one is better as another? And why?

感谢您,

穆尔

推荐答案

当你做startActivity(),所有这些都张贴你的意图的事件队列。该活动的实际开始异步发生在不久的将来。所以,我看不出两者之间有很大的区别。

When you do startActivity(), all that does is post your intent in a queue of events. The actual starting of the activity happens asynchronously in the near future. So I don't see a big difference between the two.

这篇关于完成老活动,并开始一个新的,反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆