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 activities in my application.Because of that settings if I move one activity to another the first activity is destroyed.I can save my data on the onSaveInstanceState. With out using saved instance state is there any way to do...
Thanks in advance..
If you play around with your phone's settings, then you will discover an option depicting “Don't keep activities” hidden under “Developer Options”.
Using activity. isFinishing() is the right one solution. it return true if activity is finished so before creating dialog check for the condition.
Don't keep activities under the Developer Options menu. When this option is enabled, the Android OS will destroy an activity as soon as it is stopped. It is intended to help developers debug their apps. For example, it can simulate the case that Android will kill an activity in the background due to memory pressure.
import the following package
import android.provider.Settings;
Then you can check if the option is enable using this code:
Settings.System.getInt(getContentResolver(),Settings.System.ALWAYS_FINISH_ACTIVITIES, 0);
and you can change it using this:
Settings.System.putInt(getContentResolver(),Settings.System.ALWAYS_FINISH_ACTIVITIES, 0);
Hope it helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With