问题描述
我要在主屏幕上走的时候我preSS装置的背部button.I现在用这个code ..
公共无效onBack pressed(){
this.finish();
返回;
}
pressing BACK键将有效地调用完成()
为您服务。没有必要捕获返回键。
我假设你的问题是,当你preSS BACK键,它只是活动
在你的应用程序要回previous。
如果是那么这样做的所有活动自我终结,当他们在你的应用程序启动一个新的活动
...
startActivity(新意图(这一点,MyNewActivity.class));
完();
如果你这样做,那么就没有活动
返回,当你preSS回来了,它总是会返回到主屏幕。
I want to go on home screen when I press device's back button.I am using this code..
public void onBackPressed() {
this.finish();
return;
}
Pressing the BACK key will effectively call finish()
for you. There is no need to trap the BACK key.
I'm assuming your problem is that when you press the BACK key it is simply going back to the previous Activity
in your app.
If that is the case then make all activities 'self-terminate' when they start a new Activity
in your app....
startActivity(new Intent(this, MyNewActivity.class));
finish();
If you do that then there will be no Activity
to return to when you press BACK and it will always return to the home screen.
这篇关于如何关闭我的android系统pssed回$ P $应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!