![7 sins for android 7 sins for android](https://wallpapercave.com/wp/wp4744428.jpg)
You can bitwise OR all the options for that attribute to essentially have it be "all".
![7 sins for android 7 sins for android](https://hisgames.org/images/228/7-sins.jpg)
7 sins for android android#
Hate to tell you but iOS does that and guess how many iOS users complained about that?įor android tell me when was the last time an app running on your phone was killed in the background and when you returned to it, it perfectly restored everything when you left it? And tell me when was the last time you heard people say "Wow everytime I returned to an app that was 5 pages deep in the history of the recent apps and it recovered where it was left off that's so amazing I wish iOS could do that!" "Always restarting from scratch when killed would lead to horrible user experience" If developers were given the choice to manually trigger the the recreation of the running activity instance, I bet no sane human would choose that. And for things that should absolutely be handled, it should be handled in the running activity instance. The default behavior should be handling nothing. " they still occur occasionally and developers would have to handle all the config changes manually " The android:configChanges doesn't support value "all" and even if it does, it is not the default value. But given that it's what we have to work with, I think a well designed app should adhere to it. I've had plenty of headaches because of it too. I'm not arguing that Android's recreation/restoration process is good. I think if this option existed, many devs would use it too willingly, just like how many devs already lock rotation, even though they're just covering up a much bigger problem with their app. Or face significant bugs.Īlways restarting from scratch when killed would lead to horrible user experience on many devices, especially when they happen to be switching between other high-memory apps or have a lot of background processes running. reloading and applying resources) themselves if the activity didn't restart. While config changes other than rotation are much less common, they still occur occasionally and developers would have to handle all the config changes manually (i.e.
![7 sins for android 7 sins for android](https://megagames.com/sites/default/files/game-content-images/pc7SinsS_l2.jpg)
However, the activity restarts for good reasons. You can already achieve this no-recreate behavior that you desire by specifying every option for your activity in its android:configChanges attribute in AndroidManifest.xml. It's a new method protected abstract Fragment getItem(int position). It's interesting because there already was an instantiateItem() there, they could have given any name, but no - they just called it getItem(). If they had named it createFragment() (just like they did in FragmentStatePager of ViewPager2), this problem would honestly never come up. It only works if you create the Fragment instance right there. The one thing that's always been a wonder for me though is the FragmentPagerAdapter.getItem() issue. I've never been a fan of the combined Activity lifecycle and the intent flags.īut yes, not taking super.onCreate() recreating fragments into consideration has most likely caused a lot of headaches to many people reading many stack traces. Not using Fragments and replacing them with Activities brings in its own set of complexities □, but that's not a "cardinal sin" because it doesn't really cause unexpected behavior, it just makes it tricky to do certain "should be simple" things.