I know that using string literals in Android is discouraged but I do not know why. I also would like to know what possible ways can get round this problem.
Asked
Active
Viewed 2,193 times
2 Answers
6
It's not necessarily a problem, just a warning. Android encourages the use of the strings resource file where possible but you certainly can hard-code strings and have it work correctly.
See this question/answers: what's wrong with hardcoded string in android xml file?

Community
- 1
- 1

Benjamin S
- 575
- 1
- 7
- 21
6
This isn't an Android-specific issue. It is a "best practice" for programming in general. It is always a good idea to put strings and other "localizable" data into separate files (properties files, resources, etc.). This makes localization into other languages much easier.

David Wasser
- 93,459
- 16
- 209
- 274