Using a class to store static data in Java?

前端 未结 7 723
醉梦人生
醉梦人生 2020-12-28 23:50

Is it a bad idea creating a separate class and use it as a storage which consists only of static data variables?

I am currently developing an app for android, but th

7条回答
  •  不知归路
    2020-12-29 00:37

    use SharedPreference to store flags and variables

    http://developer.android.com/reference/android/content/SharedPreferences.html

    For Global variable:

    it would be better to use the Android Application class. It's meant to store global application state

提交回复
热议问题