2

I have to store some long text, to use in textViews. i've always been using strings in a xml file, but i don't know if a java String for each text could be better, so...

Which is the best way to store them:

  1. Create strings in a XML resource file

  2. Create a class and store the text in java strings

Thanks!

GmloMalo
  • 667
  • 7
  • 14

1 Answers1

4

XML resource file would be better option. Keep the class file code as clean as possible.

Sweety Bertilla
  • 972
  • 10
  • 35
  • Thanks! Clear and fast answer! – GmloMalo Dec 08 '14 at 22:05
  • 3
    There is no reasoning provided. Why is it okay to have mess in xml resource compare to class code? What if it is a very simple class? – rpattabi Jan 05 '17 at 08:03
  • @rpattabi, one reason I use the XML files rather than Java classes is easy locale management. Example: [https://developer.android.com/training/basics/supporting-devices/languages](https://developer.android.com/training/basics/supporting-devices/languages) – Ben Bloodworth Jan 03 '19 at 18:50