What is better approach of the following in designing an Android app
res/values/Strings.xml
or Constant.java
where all Strings are public static final
?Choosing which one of them is more efficient?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With