How to close an android application?

后端 未结 6 823
遥遥无期
遥遥无期 2020-12-06 01:35

There are many question regarding this topic but there is no clear answer. Although android\'s memory management is very solid, so many people believe that we shouldn\'t kil

6条回答
  •  我在风中等你
    2020-12-06 02:20

    @Override
        public boolean onKeyUp(int keyCode, KeyEvent event) {
            // TODO Auto-generated method stub
            if(keyCode == KeyEvent.KEYCODE_BACK)
            {
                finish();
                return true;
            }
            else{
                return super.onKeyUp(keyCode, event);
            }
        }
    

    use the above method in the very first activity that is launched on app start up

提交回复
热议问题