String constant java class(created- StringConstant.java) vs string resource (strings.xml)?

Below are few points to consider before defining any string in any of the file-
1. Organize based on what makes sense!
    Like, put string constants that highlights database connection credentials, table name, column name or any internal used constant in Java class where else the strings that are displayed to the user should go into strings.xml file.
In short, strings.xml holds DISPLAY strings.
2. Constant declared in strings.xml file will be available only to context. Hence, whenever you want to use them make sure you have context to access them.
Like in Adapters.

Comments

Popular posts from this blog

@Overrride annotation introduced in Java1.5

Liskov Substitution Principle (LSP)

Marie Choco Lava