How do I make global changes throughout my app in Android?

前端 未结 3 1963
花落未央
花落未央 2020-12-18 16:39

I have a settings menu in my app which controls the units used throughout the app - metric or US units. So when the user selects one of these in the options in the menu, I w

3条回答
  •  没有蜡笔的小新
    2020-12-18 17:38

    For just a boolean? If its just a single activity calling SharedPreferencesand assigning it would be fine.

    If you have multiple activities in an application you could call it once and load it into a static class and call it that way or subclass the Application class.

    But even then it's just a boolean and you should do whatever is most convenient for you.

提交回复
热议问题