Search code examples
androidtextviewadthardcoded

Is it insecure to use hardcoded strings for xml elements?


When I use this hardcoded strings for my TextView elements, ADT warns me:

Hardcoded string "Text", should use @string resource

So is it insecure or something that ADT warns me not to use this way?


Solution

  • It's bad practice as it makes your app less configurable, but it's not unsafe.

    In the folder res/values/strings.xml you should declare the string you are using for better practice.

    Here's a guide on how to do this: http://developer.android.com/guide/topics/resources/string-resource.html