Android activity recreate itself

后端 未结 13 1533
攒了一身酷
攒了一身酷 2021-02-05 07:06

My app normally works just fine, until I face a strange problem on specific device. There are 2 activities in App. After I start ActivityB inside of ActivityA, ActivityA starts

13条回答
  •  青春惊慌失措
    2021-02-05 07:39

    I got this issue recently, and this make me annoyed. I think that issue around 2 options solution to check but useless.

    About the setting "Don't keep activities" corrected here, I used this code to check that it optional checked or not (my test device customize base on version 2.3.5 and not show this option):

    private boolean isAlwaysFinishActivitiesOptionEnabled() {
        int alwaysFinishActivitiesInt = 0;
        if (Build.VERSION.SDK_INT >= 17) {
            alwaysFinishActivitiesInt = Settings.System.getInt(getApplicationContext().getContentResolver(), Settings.Global.ALWAYS_FINISH_ACTIVITIES, 0);
        } else {
            alwaysFinishActivitiesInt = Settings.System.getInt(getApplicationContext().getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0);
        }
    
        if (alwaysFinishActivitiesInt == 1) {
            return true;
        } else {
            return false;
        }
    }
    

    Result check is false in my case. I also check the memory when running application and it nothing occur.

提交回复
热议问题