如何通过单击后退按钮在Android中杀死进程?

问题描述:

我已经在android系统。它的应用是与timer.Now我已经尝试了很多把控制研究对Android设备的后退按钮,当它是pressed过程中应死亡,直接显示应用主菜单......请帮我......请多关照..!

I have made an application in android .It is an application related to timer.Now i have tried a lot to put controll on back button of android device that when it is pressed the process should be killed and directly displays main menu...Please help me...Thanking you in advance..!

试试这个code
结果

Try this code

@Override
public void onBackPressed() {
   yourActivity.this.finish;
}