Android 并在时间到时返回主要活动

发布于 2024-10-17 19:15:10 字数 224 浏览 4 评论 0原文

我从主要活动开始一个新活动,

Intent i = new Intent(this, Game.class);
startActivity(i);

游戏活动有一个倒数到 0 的计时器。我想弹回主要活动(终止游戏活动)。

我该如何制定这个?

(我已经在我的游戏活动中正确定义了 onDestroy() 等。)

I start a new activity from my main activity with

Intent i = new Intent(this, Game.class);
startActivity(i);

The game activity has a timer which counts down to 0. I would like to pop back to the main activity (killing the game activity).

How do I enact this?

(I've already defined onDestroy() etc. correctly in my game activity.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的他你的她 2024-10-24 19:15:10

在计时器到时调用 finish() 的方法中

In the method that gets called when the timer is up call finish()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文