徹底退出android程序

int currentVersion = android.os.Build.VERSION.SDK_INT;
    if (currentVersion > android.os.Build.VERSION_CODES.ECLAIR_MR1) {
    Intent startMain = new Intent(Intent.ACTION_MAIN);
    startMain.addCategory(Intent.CATEGORY_HOME);
    startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(startMain);
    System.exit(0);
} else {// android2.1
    ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    am.restartPackage(getPackageName());
}

已經不知道出處了,這只是個人我的記錄android

相關文章
相關標籤/搜索