在 Android 中启动新活动并完成当前活动? [英] Start new Activity and finish current one in Android?

查看:22
本文介绍了在 Android 中启动新活动并完成当前活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在启动一个新的 Activity 并调用当前的 finish.

Currently I'm starting a new Activity and calling finish on a current one.

是否有任何标志可以传递给 Intent,从而无需从代码中手动调用 finish 即可完成当前的 Activity?

Is there any flag that can be passed to Intent that enables finishing current Activity without a need to call finish manually from code?

推荐答案

你可以使用 finish() 方法或者你可以使用:

You can use finish() method or you can use:

android:noHistory="true"

然后就不需要再调用finish()了.

And then there is no need to call finish() anymore.

<activity android:name=".ClassName" android:noHistory="true" ... />

这篇关于在 Android 中启动新活动并完成当前活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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