简体   繁体   中英

Don't keep activities

A problem I have got to solve is to deal with Developer Options -> Don't keep activities .

There is a complex system with a number of various classes of activities defined. It works properly when aforesaid option is OFF. However it works wrong when the option is ON,

I am striving with it for some time without result. My approach is to perform the same operation when option is OFF then when it is ON. Then compare logcat.

How to trace Activities manager to find when it goes wrong ?

Java 8, Android. System developed with Android Studio 4.0.1

Sorry, I don't have enough reputation to comment. can you describe what you're actually trying to achieve programmatically. 'Don't keep activities' makes every app run only one activity at a time. Make sure you don't have 'onSaveInstanceState' passing Data. if the activity is destroyed and recreated while looking for onSaveInstanceState, onSaveInstanceState will be null and app will crash. that's only one reason. You can use Logcat to know what happends:

Log.d(TAG,"Here");

use the code below to find out when your activity is destroyed

@Override
 protected void onDestroy() {
    super.onDestroy();
}

what ever said I need to see the code and the logcat before I can actually help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM