How to know in settings \"Don\'t keep activities\" option is enabled in ics via code. If it is in enabled,how to prevent the activity.
Note: I have used more activit
Settings.System.ALWAYS_FINISH_ACTIVITIES
now is deprecated so you should use
Settings.Global.ALWAYS_FINISH_ACTIVITIES.equals("1")
to check if this option is enabled
update(thanks Aviv Ben Shabat comment):
to handle all sdk versions I've created a method:
public static boolean isFinishActivitiesOptionEnabled(Context context) {
int result;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
result = Settings.System.getInt(context.getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0);
} else {
result = Settings.Global.getInt(context.getContentResolver(), Settings.Global.ALWAYS_FINISH_ACTIVITIES, 0);
}
return result == 1;
}