Hendra Anggrian Hendra Anggrian - 5 months ago 12
Android Question

what's wrong with hardcoded string in android xml file?

I love to put simple text directly on the xml file without declaring a string first. It is easier, more simple and less messy. However, it always has a warning badge whenever I do so.

What if I have a dozens of hardcoded string in my xml file without concerning the warning? Will I get into a trouble?

thanks in advance.

Answer

No, you will not get into trouble, but using @string/yourString in your xml will be a good practice and it will improve your app performance.

Comments