String.xml or Constants class

前端 未结 1 1227
抹茶落季
抹茶落季 2021-02-01 17:49

What is better approach of the following in designing an Android app

  1. To place all the String constants in res/values/Strings.xml or
  2. Create a
相关标签:
1条回答
  • 2021-02-01 18:23

    I imagine a constants class would be more efficient.

    However, speed shouldn't really be an issue in either case. I would recommend organizing based on what makes sense.

    Constants class

    Put strings constants that will be used internally, like database column names or other keys.

    strings.xml

    Put strings that are displayed for the user. This way you can take advantage of localization, etc.

    0 讨论(0)
提交回复
热议问题