收盘新活动活动 [英] Closing a Activity on new Activity

查看:142
本文介绍了收盘新活动活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有了一个意图按钮如下活动

I have an activity that has a button with a intent as follows

Intent i = new Intent(getApplicationContext(), MyMainActivity.class);
                   startActivity(i);
                   finish();

一旦你移动到下一个活动 MyMainActivity.class 如果你打后退按钮它显示与老resaults的最后一个活动。

Once you move to the next activity MyMainActivity.class if you hit the back button it shows the last activity with the old resaults.

有没有一种方法,使活动接近或一旦按下按钮回迁?这样,一旦活动完成这不是我的活动历史。

Is there a way to make the activity close or move back once the button is pushed? This way once the activity is done it is not my activity history.

推荐答案

使用此意图沿

Intent i = new Intent(getApplicationContext(), MyMainActivity.class);
 i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                   startActivity(i);
                   finish();

这篇关于收盘新活动活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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