为什么完成()不会立即退出处理? [英] Why is finish() not quitting processing immediately?

查看:213
本文介绍了为什么完成()不会立即退出处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有当它是得心应手不是要求后立即退出活动的任何特殊情况完成()

Is there any particular situation when it is handy to not quit the Activity immediately after calling finish() ?

(在其他的方式,这是为什么没有办法从设计立即退出活动?)

(in other way, why is this method not quitting the Activity immediately from design?)

http://developer.android.com/参考/安卓/应用/ Activity.html#完成()

更新

当我立刻说,我的意思是,就在时候你会调用完成()当然,并且在清理与节能实例包,的onStop和的onDestroy方法没有按T计数。

When I say immediately, I mean, right in time you will call the finish() and of course, cleaning up with saving instance bundle, onStop and onDestroy methods doesn't count.

要看看我到底在谈论一个例子,这里是段

To see an example what am I talking about, here is the snippet

onCreate(Bundle savedInstance){
    // code executed
    if(somecondition){
        finish();
    }
    // code which shouldn't be executed
}

问题是,为什么条件后的code结束以及结束活动前,为什么完成()呼之不应立即停止加工

推荐答案

应该不是你做一回prevent的$ C $以下CS来执行:

Shouldn't you do a return to prevent the codes below to execute:

if(somecondition){
    finish();
    return;
}

这篇关于为什么完成()不会立即退出处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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