Android中实现程序的完全退出登录

经过上网查询资料发现这个方法可以是程序完全退出登录,在打开下一个activity之前,finish()的时候,当返回的时候,它会直接退出应用,关闭了所有的activity资源,不过这个方法只适用于android2.2的版本以上的

            Intent startMain = new Intent(Intent.ACTION_MAIN);
            startMain.addCategory(Intent.CATEGORY_HOME);
            startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(startMain);
            System.exit(0);//退出程序



猜你喜欢

转载自blog.csdn.net/shasha1021/article/details/72802537