gpt4 book ai didi

java - 在执行所有行之前传递完成 Activity - android

转载 作者:行者123 更新时间:2023-11-29 06:27:37 26 4
gpt4 key购买 nike

如果我们调用 activity.finish() 并且下面有几行代码。一旦 finish() 被调用,它会被执行吗?还是忽略?

最佳答案

If we call the acitivty.finish() and there are some lines of code below that. will that be executed once the finish() has been called?

因为acitivty.finish()不是中止

检查这个例子

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.e("TEST", "BEFORE FINISH");
finish();
Log.e("TEST", "AFTER FINISH");
Log.e("TEST", "AFTER FINISH");

}

结果

enter image description here

关于java - 在执行所有行之前传递完成 Activity - android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49746460/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com