Why not use always android:configChanges=“keyboardHidden|orientation”?

前端 未结 4 2118
南方客
南方客 2020-11-22 03:28

I was wondering why not use android:configChanges=\"keyboardHidden|orientation\" in every (almost every ;)) activity?

Goods:

4条回答
  •  余生分开走
    2020-11-22 03:59

    I don see why.... occasional restarts are ok in my opinion... configChanges handles most cases for me... well maybe in some types of applications this can be problem but it depends really on type of app and how you restore state when app restarts... When one of my app restarts user is logged back and last activity opens by my code and user jus loses some steps to go back where he was but not big deal.. In other some state is always persisted and some state is always restored on restart. When activity restarted it had to be that app have not been used or something... so no problem at all... In game for example this can be problem maybe or in some other type of app I don't know...

    I say that when you do it this way applications just works fine under normal circumstances. And code is much more readable without ton of logic needed for saving and restoring where u just can make new bugs and have to maintain it all the time... sure if android gets out of power and kill you application window it lose the context and starts again, but this happen just in special situations and on newer devices I belive this is more and more rare...

    So kill me, but I use this across applications quite successfully... android:configChanges="locale|keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" But I understand that for some special kind of applications it may be not good way but most of apps can live with this just OK.

提交回复
热议问题